Nintex

Nintex Connect
Metalogix
Metalogix
BlueStripe
BlueStripe

Training - Combined Knowledge

Training - TekDog Inc

Nintex Workflow - Move Documents and Preserve Version History

  • RSS
  • Add To My MSN
  • Add To Windows Live
  • Add To My Yahoo
  • Add To Google

Statistics

  • Entries (119)
  • Comments (310)
Posted by Vadim Tabakman Monday, July 02, 2012 11:29:00 PM Categories: Nintex Nintex Workflow Versions Web Request

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

Problem

The following actions will copy a document, but not preserve the versions or version history:

Copy Item

Copy to SharePoint

Call Web Service -> Copy.asmx

The aim here is to move a document and preserve that information.

Solution

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.

Source Library

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.

DocSet

The goal is to move this document to DocSet2 and preserve the version and the version history.

Content Type: application/x-www-form-urlencoded

Headers

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:14.0.2.5420&service_name=/&oldUrl=Source/DocSet/aaa.txt&newUrl=Source/DocSet2/aaa.txt& amp;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".

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.

Version History

The Web Request action looks like this:

Web Request

 

Conclusion

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.

Downloads

Copyright Vadim Tabakman

re: Nintex Workflow - Move Documents and Preserve Version History

Monday, April 15, 2013 7:38:04 AM unknown

Hi Vadim,

I've solved my issue, looks like it was simply a case of fat finger.

Is there a way this process could work if the source and destination libraries were in different sites (one being a subsite of the other)

re: Nintex Workflow - Move Documents and Preserve Version History

Monday, April 15, 2013 3:21:52 AM unknown

Hi Vadim

I am still having problems with the document not being moved, yet no error occurring and the workflow status returning Completed.

I am not using document sets, just 2 identical document libraries on the same site

I have the document I want to move in a library at the following location

IntranetHomeSite/DepartmentSubsite/TeamSubsite/ProjectSubsite/

My Source Library is called ItemsIn

My Destination Library is ItemsOut

Web URL in the request is set as

http://IntranetHomeSite/DepartmentSubsite/TeamSubsite/ProjectSubsite//_vti_bin/_vti_aut/author.dll

The message that is being sent to the author.dll is the following

method=move+document:14.0.6029.1000&service_name=http://IntranetHomeSite/DepartmentSubsite/TeamSubsite/ProjectSubsite/&oldUrl=ItemsIn/aaa.txt&newUrl=ItemsOut/aaa.txt&url_list=[]&rename_option=findbacklinks&put_option=overwrite,migrationsemantics

Any assistance you can provide would be extremely useful

 

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, April 11, 2013 8:57:22 AM

Hi Stuart,

try changing the url in the web request to point to the destination site. Maybe that will help.

cheers,

Vadim

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, April 11, 2013 8:51:12 AM Stuart Moore

Hi Vadim,

I have attempted to use this workflow to move a file from one library to another on the same site, changing your oldurl and newurl values for Site\Library\DocName of my own, but although it completed without error.  the file does not actually get moved.

I have permissions on the sites and libraries.

Any idea what I could be doing wrong

re: Nintex Workflow - Move Documents and Preserve Version History

Tuesday, March 05, 2013 12:53:09 PM

Hi gman,

I believe it should be possible in NW2007 also, since SharePoint 2007 has an author.dll also.

I haven't tried this though :).

cheers,

Vadim

re: Nintex Workflow - Move Documents and Preserve Version History

Tuesday, March 05, 2013 8:53:17 AM Gman

Excellent job, Vadim. Aside from the Document Set, can the move function be applied in 2007?

re: Nintex Workflow - Move Documents and Preserve Version History

Monday, February 25, 2013 6:26:28 PM Tim2

Hi Vadim,

When using author.dll to move a document between libraries the "modified by" property for all versions of that document changes to the user credentials passed in the Web Request.  I am attempting to preserve these details and I beleive that the put_option "migratesemantics" is supposed to acheieve this.  Although, I have not been successful in my attempts.   Do you have any suggestions on what I might be able to do (or use in place of).

Tim

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, February 21, 2013 10:07:37 AM

Hi Tim,

I'm not 100% sure, but I think it would work as long as the credential you use were for a user that had permissions to both locations.

cheers,

Vadim

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, February 21, 2013 10:03:55 AM Tim

Thanks for posting this! very usefull! Do you know if it possible to use this method and move files cross-site?

 

re: Nintex Workflow - Move Documents and Preserve Version History

Wednesday, January 23, 2013 12:44:05 PM

No I haven't tried with a SSL site.  I don't have one available to test it out on, sorry.

re: Nintex Workflow - Move Documents and Preserve Version History

Wednesday, January 23, 2013 2:43:26 AM unknown

did you try to request a https site content,  i have a problem to access https site;

re: Nintex Workflow - Move Documents and Preserve Version History

Monday, January 21, 2013 7:34:10 PM unknown

This is exactly what I want to do, but I can't figure out how to get it setup.  Where is the screen "Configure Action - Web Request"?  Any further hints to set this up would be much appreciated!

re: Nintex Workflow - Move Documents and Preserve Version History

Friday, January 18, 2013 4:02:16 AM unknown

Bingo.. Commission is in the mail :)

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, July 12, 2012 1:04:06 PM

I'm afraid I haven't figure out how to do this with list items.  Hopefully one day :)

re: Nintex Workflow - Move Documents and Preserve Version History

Thursday, July 12, 2012 12:39:39 AM unknown

what about list items?