November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
What exactly would you like to know. Sender should give you who is ending the event but can you be more specific on what you mean by "Who triggered me". are you looking for a class, another event, or scheduled job, etc..
Hi Joshua,
I am looking for what class did the save action. The sender in the event is always of type {EPiServer.Core.DefaultContentEvents}, so unless there is a way to drill down in this object to get the original invoker, I don't see how the sender object helps.
I've also tried to set the ContentEventArgs.Creator property in the Publishing event, but this always cancel the save.
The creator property is for creating new page not for updating any existing page.
One of the alternate would be kinda hack you can extend newsPage and add an object within it. Decorate that object with [ignore] so it does not apepar in editor section and pass the source in the newsPage where you are saving content.
Cheers
Hi Murtaz, thanks for the answer, I've marked your reply as an answer to the problem. Hackish, but I guess EpiServer can't do any better.
Steinar,
If you think that most developers would benefit from your suggestion, please add it to the feature requests forum: https://world.episerver.com/forum/developer-forum/Feature-requests/.
The heading of this topic questions on how to pass information between content event handlers, that can be done using the property ContentEventArgs.Items which is a dictionary that you can use to pass data between event handlers.
Regarding the question on what code that triggered the event, you could use type SystemDiagnostics.StackTrace from .net to do so, like:
var stackTrace = new StackTrace(); // get call stack var frames = stackTrace.GetFrames(); // get method calls (frames)
You should though be aware that GetFrames method is performance wise a quite expensive call.
Hi, I've created a IContentEvents.PublishedContent handler. In this handler I would like to know what code triggered the PublishContent event.
Is there any way to do this?
A code example
I'm on EpiServer CMS 9.