I created a Nintex Workflow 2010 workflow for a client that ended with the document set the workflow runs on being copied to another document library for archival. The “Copy to SharePoint” action in Nintex is used in the workflow to accomplish the library copy.
I received the following error in the workflow upon trying to copy the document set to another library:
“Failed to copy item. DocID: Site prefix not set.”
After some investigation, I determined that the a site collection feature called “Document ID Service” needed to be activated in order to copy the document set to another library. After activating the feature, the timer job that runs this service needs to run over night in order to accomplish its indexing.
The document set was succesfully copied to the archive library after retrying the workflow the next day.
Hi!
You don’t have to activate the document id feature, just ensure that in the property bag of the root web of the destination site collection (where the document set will be imported again) exists a property named “docid_msft_hier_siteprefix” with an value of “” (empty string).
Use this powershell-script:
$site = Get-SPSite http://host/sites/yoursite
$properties = $site.RootWeb.Properties
$properties[“docid_msft_hier_siteprefix”] = “”
$properties.Update()
Note that i use the old property bag RootWeb.Properties instead of the new hashtable RootWeb.AllProperties, thats because the class Microsoft.Office.DocumentManagement.Internal.OobProvider still uses that.
So why is it failing when a document set is imported? The function DocumentSet.ImportProperties() catches an ArgumentException while trying to set the document id of the document set list item (so there’s no problem if the document id column doesn’t exist yet).
But they missed that the function OobProvider.GetSitePrefix() which is called through the function OobProvider.GenerateDocumentId() throws an InvalidOperationException if the property bag doesn’t contain the prefix property.
sorry, correct code with an if:
$site = Get-SPSite http://host/sites/yoursite
$properties = $site.RootWeb.Properties
if ($properties[“docid_msft_hier_siteprefix”] -eq $null)
{
$properties[“docid_msft_hier_siteprefix”] = “”
$properties.Update()
}
Hi ,I am new to powershell…can you please tell
how to use this code?