Document ID Provider, the last one?

By | 2010-06-21

For a client of ours we wanted to create a Custom SP2010 Document ID Provider. For this provider I wanted to be able to adjust and configure it so I can use it for other customers also.
First I needed to know how to create a Document ID Provider and found that: Tobias Zimmergren had an excelent article on creating you own SP2010 Document ID Provider.

Next in order to create a unique sequenced number I immediatly thought of SQL Server. And found that Ton Stegeman had an equally usefull post on how to create your own SPDatabase object in a SharePoint Farm.

Now I was set to create “the last Document ID Provider” for SP2010 I was ever going to write. Perhaps not but still, it should suffice for a LOT of clients of us!

I wanted to end up with an admin page like this:



This should then result in this document id:



So how to do this?
Step 1
Create a Database with a Table where I can store my generated document id’s

And a stored procedure to Get/Insert ID’s:

There is more to it than this, but you can check out the downloads for all the details.
Step 2
Create an SPDatabase object for this Database, see the Ton Stegeman post!

Step 3
Create a Document ID Provider that uses this SPDatabase and generates Document ID’s based on some settings. What I did was generate the sequenced number in SQL and then format that in a method with the other variables. Generating a YEAR or DAY into a string is fairly easy.

Step 4
Create an Central Admin page to change the settings of our Document ID Provider ( see screenshot ).
You can use the SPFarm.Local.Properties to score your settings Farm Wide:

The scope:

Downloads
Download solution
Download sources

How to use the solution

One thought on “Document ID Provider, the last one?

  1. Adam Dawson

    This is awesome. I installed this on my 2013 farm and everything worked great. My question now is can I set the document ID in each list item to a number that is being caried over from an old system? We are in the middle of migrating everything to SharePoint 2013 from some antiquated system and would like to keep the ID’s from this system seeing as everyone already knows what they are and reference them all over the place.

    Reply

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.