{"id":1320,"date":"2012-09-04T11:54:29","date_gmt":"2012-09-04T11:54:29","guid":{"rendered":"https:\/\/poiseddevelopers.com\/reality-tech\/?p=1320"},"modified":"2024-04-26T12:26:40","modified_gmt":"2024-04-26T12:26:40","slug":"structure-document-ids-to-be-unique-across-site-collections","status":"publish","type":"post","link":"https:\/\/poiseddevelopers.com\/reality-tech\/structure-document-ids-to-be-unique-across-site-collections\/","title":{"rendered":"Structure Document IDs to be unique across Site Collections"},"content":{"rendered":"<h4>Configure Document IDs to be unique across the farm<\/h4>\n<p>Document IDs are only guaranteed unique within a single site collection. SharePoint tries to ensure uniqueness by putting a random prefix in front of each Docuemnt ID, and setting that at the Site Collection level. However you can easily rationalize these, and make the Document IDs a bit easier to read. The script below assigns a prefix, and sets up SharePoint to reissue Document IDs. Note the actual regeneration of Document IDs will wait until the Document ID Assignment Timer Job runs. This job can take a long time to run, depending on the number of items in your Site Collections.<\/p>\n<div><\/div>\n<p>&nbsp;<\/p>\n<pre lang=\"php\"> [system.reflection.assembly]::LoadWithPartialName(\"Microsoft.Office.DocumentManagement\") \r\n$siteUrl = \"http :\/\/SharePoint\/ManagedPath\"  #this is the header prefixing my Site Collections\r\n \r\n$LoopString = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z\"  #Here are the individual Site Collections\r\n$LoopStringArr = $LoopString.Split(\u201c,\u201d)\r\n \r\nforeach ($letter in $LoopStringArr)\r\n{\r\n    $SiteName=$siteurl+$letter\r\n    write-host $SiteName\r\n \r\n    $Site = New-Object Microsoft.SharePoint.SPSite($SiteName)\r\n    [Microsoft.Office.DocumentManagement.DocumentID]::EnableAssignment($Site,$false)   #First disable, then enable DocID assignment\r\n    [Microsoft.Office.DocumentManagement.DocumentID]::EnableAssignment($Site,$true)\r\n \r\n \r\n    $rootweb=$site.rootweb\r\n    $rootweb.properties[\"docid_msft_hier_siteprefix\"]=\"Ins$letter\"  # This is the property holding the Document ID Prefix which we use to ensure uniqueness\r\n    $rootweb.properties.Update()\r\n    $rootweb.Update()\r\n    [Microsoft.Office.DocumentManagement.DocumentID]::EnableAssignment($Site,$true,$true,$true)  # now we can force all Document IDs to be reissued\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Configure Document IDs to be unique across the farm Document IDs are only guaranteed unique within a single site collection. SharePoint tries to ensure uniqueness by putting a random prefix in front of each Docuemnt ID, and setting that at the Site Collection level. However you can easily rationalize these, and make the Document IDs [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":561,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-document-ids"],"acf":[],"_links":{"self":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/comments?post=1320"}],"version-history":[{"count":1,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1320\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1320\/revisions\/1341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media\/561"}],"wp:attachment":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media?parent=1320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/categories?post=1320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/tags?post=1320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}