While it is simple to set the prefix of Document ID Service in SharePoint 2013 manually, it’s less straightforward if you are looking to set it up programmatically (but still fairly simple once you know how). If you’ve been wondering how to do this correctly, last week, Perficient’s Peng Zhao wrote a blog post that walks through the necessary steps.
This post introduces you to a correct way to set up Document ID Prefix in SharePoint 2013. Immediately after you kick off the timer jobs for Document ID service in this approach, all of your documents under the new site will show up with correct prefix.
We have recently rolled out a web template based on our team site template. It requires you to set the prefix of Document ID service when the user is creating a site with the web template. It is simple if you can do it manually in the “site settings>>Document Id Settings” like this:
If you plan to do it programmatically, it is a different story. The articles or blogs I searched on the Internet demonstrate that the following will do the trick:
It sets the root web property “docid_settings_ui”. It also sets the prefix value on the Document ID Settings page as if it were set manually. If you go to the settings page, the prefix string shows up there; nothing seems wrong. But after you kick off your timer jobs for Document ID service, you will find all your documents never get the new prefix.
The CORRECT way to set the document id prefix should be like this:
Neat and simple, right?
In this way, right after you kick off the timer jobs for Document ID service, all your documents under the new site will show up with correct prefix.
Thanks Peng Zhao and Matt Connolly for sharing this tip!
Better solution to do it via Powershell