Skip to main content

Development

Set Document ID Prefix Programmatically in SharePoint 2013

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:

SharePoint2013 Document ID Settings

SharePoint 2013 Document ID Settings

 

 

 

 

 

 

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:

SharePoint2013 Document ID Settings by web properties

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:

SharePoint2013 Document ID Settings by server side model

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.

Thoughts on “Set Document ID Prefix Programmatically in SharePoint 2013”

  1. This was an issue we found in one of our SharePoint 2013 projects.
    With special thanks to Matt Connolly who points me in the right direction.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram