PDATE : This also works in Office 365. Screenshot at the bottom of this post.
Thanks to some amazing people that I work with (Blake Nussey, Jarad Smith and Andrew Jolly), I was finally able to get the process of moving a document to another library or document set and preserve it’s version number and history. It was no small feat. I think just to get it to work once, it took me about 26 times to publish the workflow. Mostly, it was my own fat fingers and having spelling mistakes or uppercase when lowercase was needed (or vice versa) etc.
Often, when workflow designers (humans) need to move a document in SharePoint via a workflow, they will perform a Copy of the document and then a Delete of the original. The problem with that, is that all version history is lost.
My colleagues pointed me the SharePoint author.dll. You can use the Web Request action in Nintex Workflow to make an RPC call (POST) to it, specifying the Move Document command. http://msdn.microsoft.com/en-us/library/ms440627.aspx
The following actions will copy a document, but not preserve the versions or version history:
Copy to SharePoint
Call Web Service -> Copy.asmx
The aim here is to move a document and preserve that information.
What we can do, is call the author.dll “Move Document” using the Nintex Workflow Web Request action.
In the example I have, I’ll be moving a document from one document set, to another document set.
My Source document library has 2 document sets. Inside DocSet is a document named aaa.txt.
I’ve put an “Initial.txt” file into root of this library. I will then run the workflow on this file.
Looking at the DocSet, you can see there is a single file in there “aaa.txt” and it is on version 3.0.
The goal is to move this document to DocSet2 and preserve the version and the version history.
Content Type: application/x-www-form-urlencoded
X-Vermeer-Content-Type – application/x-www-form-urlencoded
The message that is being sent to the author.dll is the following: method=move+document:22.214.171.12420&service_name=/&oldUrl=Source/DocSet/aaa.txt&newUrl=Source/DocSet2/aaa.txt&url_list=&rename_option=findbacklinks&put_option=overwrite,migrationsemantics
The service_name is the site. My site is the root site, so it’s just a forward slash /.
oldUrl is the library/docsetname/filename
newUrl is the same format as above.
The rest we leave to the reader to investigate : http://msdn.microsoft.com/en-us/library/ms440627.aspx
When we run the workflow, the document now moves to the second document set “DocSet2”.
If you click on the document and look at the version history, you’ll see all the versions and the comments that were put in.
The Web Request action looks like this:
This also works in Office 365. You need to use the Web Request action, and configure it as in the picture below:
What would be good, is to make this into a User Define Action and make it reusable. If I have time, I’ll try to do that.