I need a functionality in which something happens after the properties of a document in document library get updated. I need some kind of event to fire after the user clicks Save button in edit form. Could someone briefly explain what do I need to use to make this logic or share some links that could help me understand where to start? I am looking for some code samples. If I am looking for an event, I know how to implement an event handler method body, I just need help with writing or getting that event or event handler itself. Thanks.
-
What do you need to do? It's possible that a workflow would work too, can you explain more what you need to accomplish after the item is saved with updated metadata?– Eric AlexanderCommented May 23, 2012 at 12:21
-
Sure, when the user edits the properties of the document those values should also be entered for some other list items in some other lists on SharePoint site. It's like updating two lists from the same location.– BorisCommented May 23, 2012 at 14:30
2 Answers
I would suggest reviewing Karine Bosch's blog posts series on SharePoint Event Receivers that includes simple Walkthroughs with Document Library Event Receivers.
-
Great, I'll take a look! If it helps me understand how to implement my code, I'll mark your answer as correct. Thanks!– BorisCommented May 23, 2012 at 14:31
-
-
She's also the developer of CAML Designer - a very versatile SharePoint development tool - karinebosch.wordpress.com/2012/05/12/caml-designer Commented May 24, 2012 at 14:04
You could do this with a workflow as long as there is a logical link between the document and the list(s) like a lookup column from the list(s) to the document library item. When the document library item is edited, it looks up those lists and edits the corresponding values to keep the data in sync.
-
I am not completely sure the workflow would work here because the only relation I have between the document whose properties are being updated on one side, and the document whose properties should be updated on the other side is the file name. So, I think that the event receivers or something like that might be more suitable. I could be wrong of course, what do you think?– BorisCommented May 23, 2012 at 15:09
-
It's probably the way to go in your case, I wanted to toss it out there as an alternative. The success of the workflow route depends a lot on how the lists and libraries are designed, if you don't create lookup columns to ensure relationships between the files, it can be difficult to keep things in sync with workflows. Commented May 23, 2012 at 15:22