开发者

Programmatically Updating a document library in Sharepoint

开发者 https://www.devze.com 2022-12-15 04:35 出处:网络
Im quite new to SHarepoint. I have a requirement like, i need to move some documents from different document libraries to a document library named \"Region\". So that each time a document is updated i

Im quite new to SHarepoint. I have a requirement like, i need to move some documents from different document libraries to a document library named "Region". So that each time a document is updated in these document libraries , the document should be updated in the library "Region" as well. I wrot开发者_如何学Goe a c# function in a class library,to copy the documents to the library and added the dll to that sites Bin folder.Function is working fine. But Im stuck up , Im n ot sure where to call this function.In which event should i write it, so that each time any of these documents are modified, that change has to be reflected in the "Region" library .


You have to create a SharePoint event handler and attach it to all the document libraries where you change the documents. You will then override the ItemAdded and ItemUpdated methods to perform the copying.

See more info in this StackOverflow discussion: SharePoint running a method when item added to a library


Using an event handler is probably the best way to go as mentioned by naivists. Alternatively, if the work you are carrying out is part of a larger whole, e.g. a Workflow, then you may want to consider creating a Visual Studio Workflow, which may be quite complex to get started with, or use a simple tool like the Workflow Power Pack that allows simple C# snippets to be added directly to SharePoint Designer Workflows.

Have a look at these articles. More info can be found here.

Note that I worked on the Power Pack so I am biased. Having said that it works great ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消