Hooking Event Handlers for File based events in EPi CMS

Vote:
 
Hi, I am trying to hook event handlers for events related to adding, deleting, moving etc a file. I have previously hooked the Page related events in an HTTP module. From looking at the api documentation it appears that I could hook the file related events somewhere in the episerver Workflow foundation part of the api. However, it's not clear where to do this, or if its the right place to do it. Can anyone point to where I can register the event handlers for file based events please? Kind regards, Andy
#15715
Jul 17, 2007 17:53
Vote:
 
Hi! Try looking at the class UnifiedFile in the EPiServer.Web.Hosting namespace. This base class has pre and post events for most common events for a file within EPiServer.
#16208
Jul 18, 2007 9:37
Vote:
 
Many Thanks, that seems to provide the event hooks I need. Two more questions: 1. the eventargs only seem to provide the virtual path of the file. Is it possible / where is it possible to find out the category, doc type, guid and other extra properties of the file? Can i create a File object using the virtual path? Can I find the submitted XForm? 2. Is the filesummary.config the only place to define the xform for Files? I'm looking at ways to make the Types data from the Topic Map and a more dynamic way of getting the list would be very useful. Can I either a) use a XPath expression to grab data from a URL b) hook some xform creation event to override where the selection data comes from. thanks again, Andy
#16209
Jul 18, 2007 13:36
Vote:
 
Hi again! 1. The sender object for the event handler is either a UnifiedFile or UnifiedDirectory depending on which event you have attached to. So just cast it and you will have your file. In the case that you the file that triggered the event is a VersioningFile this has a Summary property with the meta data for the file. Ex: void UnifiedFile_UnifiedFileDeleted(object sender, UnifiedVirtualPathEventArgs e) { UnifiedFile file = (UnifiedFile)sender; DoLogic(); } I just updated the event handlers for UnifiedFile and UnifiedDirectory so that the sender is typed, so in the RC4 release the code will look like this: void UnifiedFile_UnifiedFileDeleted(UnifiedFile sender, UnifiedVirtualPathEventArgs e) { DoLogic(); } 2. As far as I know editing the XForm file is the only way to alter the custom summary for a file. I'll try to dig a bit deeper into this and see if we find a way to change the summary.
#16210
Jul 19, 2007 15:14
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.