docset_welcomepage_big

Every so often while working in SharePoint, you encounter a feature that has almost no documentation or you can’t find anyone with a similar issue.  This happened to me when I was trying to configure a workflow to move a document set to a Records Center.  After I got this to work, I wanted to try and save others the grief and frustration that I experienced.  If “Unknownerror” means anything to you, this post is for you.

Who Would Use This?

This action might be useful in document management scenarios, where documents have a formal “approval” process, and management policies are defined to “expire” them to meet retention policies.  Once expired, they would be removed from the current location and moved to another location, specifically a Records Center in this case where they sit waiting to be purged from the system. 

A Detailed Look

Let’s cover some background.  For this to work, there is some pre-work and configuration that has to be done.  You have to have configured content organizers on the source and destination sites and routing rules.  I won’t cover that here.  This post is just to explain a particular component in this overall process.

The workflow action we are talking about is Send Document Set to Repository.  It is NOT available with SharePoint Foundation, you have to have at least SharePoint 2010 Standard or higher.  The only official documentation for usage from Microsoft is here.  Here is their explanation:

This action is initially displayed in workflow steps as Submit Document set using this action to this destination content organizer with this explanation (Output to Variable: submit file result). It allows you to move or copy the document set to a document repository. A document repository can be a library in your SharePoint site, or a site on its own like the Document Center, that routes records to a specific destination based on rules that you define.

Following is an example of what the action might look like in a workflow step:

Submit Document set using Copy to DocumentRepository:GUID with Copy final bill of Material to repository (Output to Variable: Copy Document Set to repository)

To add When you add this action to your workflow, it looks like this:

SNAGHTML1c990d2

Let’s break this down:

  • this action – Choose your method of submittal.  You can choose either to Copy, Move, or Move and Leave a Link.
  • this destination content organizer – This is the URL to the destination Record Center site (with the content organizer configured).
  • this explanation – This is text that will get logged to the workflow history list when this action is executed. 
  • Output to Variable: submit file result – This variable will store the output from the command, with success or any error messages and log them to the workflow history list.

The big question is what do do you enter for the destination content organizer?  From the Microsoft article above, it’s “documentrepository:GUID”.  Is this the GUID of the Records Center site?  The Drop Off Library?  A few bloggers have said it should be the link to the web service.  Which is it?

The answer is they’re both right.  The Microsoft article is correct, but it also doesn’t tell the whole story.  To correctly work, you should enter the URL of the content organizer web service on the Records Center site.  It should be entered in the format:

http://portal/recordcenter/_vti_bin/OfficialFile.asmx

If you enable verbose diagnostic logging for Workflows, you will see that SharePoint converts the first portion of the URL <http://portal/recordcenter> to <documentrepository:2fdee837-9501-4305-b15a-0bf5fb9a8832>, with the GUID is the ID property of the Record Center site collection.  The Microsoft article should really be updated to reflect this.

Potential Errors

When this doesn’t work correctly, the error is vague to say the least.  All you will see is Unknownerror.  Great, thanks, that’s really helpful.  To get any kind of decent error message, you need to up the ULS logging to verbose for the Workflow categories.  You can find directions here on TechNet.  Once that is set, run the workflow again and you should get more specific errors.  There can be errors like:

    • OfficialFile::SubmitFile: Encountered error when sending file http://portal/testsite/Documents/DocSet_Test.zip to documentrepository:2fdee837-9501-4305-b15a-0bf5fb9a8832/_vti_bin/officialfile.asmx: The URI prefix is not recognized.
    • The documentrepository:2fdee837-9501-4305-b15a-0bf5fb9a8832/_vti_bin/officialfile.asmx site is not properly configured for this request.
    • OfficialFile: File http://portal/testsite/Documents/DocSet_Test.zip was not saved at router location /recordcenter/DropOffLibrary. Exception Object reference not set to an instance of an object. thrown at:

      at Microsoft.Office.RecordsManagement.RecordsRepository.OfficialFileCore.SaveFileToFinalLocation(SPWeb web, EcmDocumentRouter router, EcmDocumentRouterResultProperties resultProps, Stream rgbFile, Hashtable fileMetaData, String strSourceUrl, String strUserName, Boolean bCopy, Boolean bIsDocSet, Boolean bIsDropOffZone, SPListItem& itemFinal)

All of these errors are caused by the fact that the content organizer isn’t setup correctly.  The best way to test this is manually by creating SendTo rules in Central Administration to the Records Center and try to move the document set.  If it works, you should be good.  If not, check the configuration.  In my case, the document set content type wasn’t added to the drop off library.  Once I corrected this and had proper routing rules setup, it moved fine, and I got Success in the workflow output.