I have created a Document library in SharePoint 2010 site. Now I 开发者_JAVA技巧want to execute some code whenever new document is added to this Document library.
How do I implement this? Do I need to implement Item Event Listener? and how this Item Event Listener will be connected to Document library. Can I call a Web service into Item Event Listener?
Be careful reading links that pertain to sharepoint 2010. Sharepoint 2007 links may contain out of date logic.
- In how they dispose of SPSite/SPWeb objects
- Not using properties.Cancel
- EventFiringEnabled instead of DisableEventFiring()
http://msdn.microsoft.com/en-us/library/ff728093.aspx
http://msdn.microsoft.com/en-us/vstudio/Video/ff623003
For binding the receiver to a list
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/19d9ccac-0bfd-4923-8518-8decedc4617d
And it you have the permissions right, you should be able to do most things in an event receiver. Look into elevating the user context.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
精彩评论