|
Home > Archive > Microsoft Content Management Server > June 2005 > Advice for MCMS Event Handler
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Advice for MCMS Event Handler
|
|
| Simon Chalfont 2005-06-24, 8:48 pm |
| 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
| |
| Simon Chalfont 2005-06-27, 5: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;
...
}
| |
| Stefan [MSFT] 2005-06-27, 5: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;
> ...
> }
| |
| Simon Chalfont 2005-06-27, 5: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 error.
>
> Cheers,
> Stefan
>
Thanks Stefan,
I thought I had it when I found this
(http://msdn.microsoft.com/library/e...cmsmdsg_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?
|
|
|
|
|