I have used myDocumentSet.export and DocumentSet.Import method to move a document set from a document library to another library within same site and same site collection. However it gets a new Document ID. According to this article it will keep its docuement Id http://office.microsoft.com/en-us/sharepoint-server-help/enable-and-configure-unique-document-ids-HA101790471.aspx
. My question is how can I move a document set from a library to another programmatically without changing its document ID?
Add a comment
|
1 Answer
You can move document sets either by using "Manage Content and Structure". Make sure use "Move To" actions in that, don't use copy, it will move document sets to another library without changing its document id.
Another way is to do programmatically, in that case consider document sets as folder to move into another library where Migrate1 is document set Name.
> SPWeb web = properties.Feature.Parent as SPWeb;
> if(web.GetFolder("server-url/sites/publishing/sourcelibraryname/Migrate1").Exists)
> {
> SPFolder folder=web.GetFolder("server-url/sites/publishing/sourcelibraryname/Migrate1");
> folder.MoveTo("server-url/sites/publishing/targetlibraryname/Migrate1");
> }