In this article we will be seeing how to change the custom document id provider
to the default document id provider in SharePoint 2010.
Once the custom document id provider is configured we can change that to the
default document id provider using API or powershell script.
Using C# code:
- Add the following references.
-
Microsoft.SharePoint.dll
-
Microsoft.Office.DocumentManagement.dll
- Add the following namespaces.
-
Using Microsoft.SharePoint;
-
Using Microsoft.Office.DocumentManagement;
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
Microsoft.SharePoint;
using
Microsoft.Office.DocumentManagement;
namespace
ConsoleApplication
{
class Program
{
static void
Main(string[] args)
{
SPSite site = new SPSite("http://serverName:20/");
DocumentId.SetDefaultProvider(site);
site.Dispose();
}
}
}
Using powershell script:
$site = Get-SPSite http://servername:20/
[Microsoft.Office.DocumentManagement.DocumentId]::SetDefaultProvider($site)
$site.Dispose()