Advice for MCMS Event Handler
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Advice for MCMS Event Handler




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Advice for MCMS Event Handler  
Simon Chalfont


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-25-05 01:48 AM

Hi,

I'm writing an event handler for CmsPosting_Deleting.  I want the code
to do some checks and cancel out of the Deletion if necessary.  I've
seen that I can set "e.Cancel = true;" in order to back out of the
deletion, however, I'm not sure how I can pass back a message to the
user informing them why the action was cancelled.  Any suggestions?

Ideally, I'd like to populate some sort of Label (but I can't see how ot
access the Page in question).  Alternatively, could I throw a custom
exception and allow MCMS to show it in the red box that appears by
default for MCMS exceptions?

Thanks in advance





[ Post a follow-up to this message ]



    Re: Advice for MCMS Event Handler  
Simon Chalfont


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-27-05 10:51 PM

Simon Chalfont wrote:
> Hi,
>
> I'm writing an event handler for CmsPosting_Deleting.  I want the code
> to do some checks and cancel out of the Deletion if necessary.  I've
> seen that I can set "e.Cancel = true;" in order to back out of the
> deletion, however, I'm not sure how I can pass back a message to the
> user informing them why the action was cancelled.  Any suggestions?
>
> Ideally, I'd like to populate some sort of Label (but I can't see how ot
> access the Page in question).  Alternatively, could I throw a custom
> exception and allow MCMS to show it in the red box that appears by
> default for MCMS exceptions?
>
> Thanks in advance

Further to the above, if I don't set the SupressExceptionOnCancel flag
then a message appears in red text within the default console as thus:

Error Details:
Update operation cancelled. The current modifier method or property set
has been cancelled by a custom event handler.

Is there a way to customise this by overriding the
PublishingEventCancellationException?  If so, how can I do this within:

public void CmsPosting_Deleting( Object sender, ChangingEventArgs e )
{
e.Cancel = true;
e.SuppressExceptionOnCancel = false;
..
}





[ Post a follow-up to this message ]



    Re: Advice for MCMS Event Handler  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-27-05 10:51 PM

Hi Simon,

I haven't tried but I think the only possible way to get a custom message
would be to implement a custom error mode container for your specific error.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


"Simon Chalfont" <simon_chalfont@hotmail.com> wrote in message
news:uHu3ksxeFHA.3848@TK2MSFTNGP10.phx.gbl...
> Simon Chalfont wrote: 
>
> Further to the above, if I don't set the SupressExceptionOnCancel flag
> then a message appears in red text within the default console as thus:
>
> Error Details:
> Update operation cancelled. The current modifier method or property set
> has been cancelled by a custom event handler.
>
> Is there a way to customise this by overriding the
> PublishingEventCancellationException?  If so, how can I do this within:
>
> public void CmsPosting_Deleting( Object sender, ChangingEventArgs e )
> {
>   e.Cancel = true;
>   e.SuppressExceptionOnCancel = false;
>   ...
> }







[ Post a follow-up to this message ]



    Re: Advice for MCMS Event Handler  
Simon Chalfont


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-27-05 10:51 PM

Stefan [MSFT] wrote:
> Hi Simon,
>
> I haven't tried but I think the only possible way to get a custom message
> would be to implement a custom error mode container for your specific erro
r.
>
> Cheers,
> Stefan
>
Thanks Stefan,

I thought I had it when I found this
(http://msdn.microsoft.com/library/e...
msmdsg_topic13
- Writing Workflow Event Handlers) but unfortunately it doesn't seem to
work.  I modified the code to execute within the CmsPosting_Deleting
event handler and changed errorModeContainerMode string to
"FailedDelete" but without success.

Out of curiosity has anyone managed to get that sample to work, as I
read elsewhere that "MS Support say that the workflow handlers do not
support raising errors to the console" which seems contradictory to the
sample provided in the Developers guide.

Although the code executes, rather than return to the page that is to be
deleted and show the custom error in the console, the page redirects to
the page's channel for some reason.  Any thoughts?





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:36 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register