Microsoft Content Management Server - Action on SAVE or SAVE&EXIT events

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > February 2007 > Action on SAVE or SAVE&EXIT events





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 Action on SAVE or SAVE&EXIT events
NickCowley

2007-02-28, 7:19 am

Hello

I currently have code that fires on Posting Submit to update Metadata, etc,
which works fine.

However, I need to fire the same process on a Save and/or Save&Exit, but,
when I add the code to the Changed event is get Invalid Cast error.

It boils down to the fact that on Submitted event the ChangedEventArgs
object is a Posting, but, if a save is fired the Changed event
ChangedEventArgs is a Placeholder.

I need the Posting object to pass to my code to do the updates.

Is there an easy way to acomplish this or am I going around it the wrong way?

Many thanks in advance for any help.

Kind Regards

Nick
Stefan Goßner [MSFT]

2007-02-28, 1:16 pm

Hi Nick,

there should also be a Changed event firing where e.Target is Posting.
You just have to ignore the other events.

E.g. by adding this code:

if (e.Target == Posting)
{
// .. your logic
}

Cheers,
Stefan



"NickCowley" <NickCowley@discussions.microsoft.com> wrote in message
news:92E963EE-9813-4A78-B00E-6F249888B949@microsoft.com...
> Hello
>
> I currently have code that fires on Posting Submit to update Metadata,
> etc,
> which works fine.
>
> However, I need to fire the same process on a Save and/or Save&Exit, but,
> when I add the code to the Changed event is get Invalid Cast error.
>
> It boils down to the fact that on Submitted event the ChangedEventArgs
> object is a Posting, but, if a save is fired the Changed event
> ChangedEventArgs is a Placeholder.
>
> I need the Posting object to pass to my code to do the updates.
>
> Is there an easy way to acomplish this or am I going around it the wrong
> way?
>
> Many thanks in advance for any help.
>
> Kind Regards
>
> Nick



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com