Most of the state-in-the-art document management system are providing a way to autommatically assign a unique Document ID identifier when a document is uploaded. This is particularly usefull when a document is moved and hyperlinks to this document have been set.
This functionnality was not supported in SharePoint 2007 but is now fully out-of-the-box in SharePoint 2010. By default, the only thing you can specify for this ID generation is a prefix. Usual example is the name of the company. Let’s say your company name is companyABC and you want all the documents to have an ID like companyABC-1234, you can do that by specifying a prefix in the Central Administration settings and it does not require any development. When a unique ID is generated, the direct hyperlink to the document is replace with a link to a redirection page named docidredirect.aspx with the ID as a parameter.
If you want to specify your own document ID generation algorithm, it is pretty straightforward as SharePoint 2010 support custom Doc Id Providder. You just have to follow this steps:
- Create an empty SharePoint project in VS 2010
- Add a class that derives from DocumentIDProvider (from Microsoft.Office.DocumentManagement Namespace)
- Override the GenerateDocumentId method that takes a SPListItem as a parameter and return the generated Document ID as a string
- Add a new feature receiver in your VS 2010 project and implement the FeatureActivatedMethod and just call DocumentID.SetProvider Method
- Confirm that everything is working properly by going to the Document ID Provider settings in the Administration and observe that a custom provider is now defined: