Document Id is something which SharePoint internally assigns to documents and maintains a uniqueness for each document.
This Document Id never changes even if the document is moved anywhere else and so can be used as a bookmark to the document.
Just in case you want to access the DocId value or want to change it (not recommended though !!), you can refer to the the internal SharePoint column _dlc_DocId.
Get Doc Id value for a document
$item["_dlc_DocId"]
Set Doc Id value for a document$item["_dlc_DocId"] = "NewId-12345"
Here is a complete example using PowerShell to access and modify the Document IdPowerShell script to get and set the Document Id (_dlc_DocId) column
$web = Get-SPWeb http://SharepointSiteUrl
$list = $web.lists["Shared Documents"]
//Get handle of item by ItemId
$item = $list.getitembyid(1)
//Get the Document Id using column _dlc_DocId
$item["_dlc_DocId"]
//Checkout before making changes
$item.File.CheckOut()
//Set the Document Id using column _dlc_DocId
$item["_dlc_DocId"] = "NewId-12345"
$item["_dlc_DocIdUrl"] = "http://SharePointSiteUrl/_layouts/DocIdRedir.aspx?ID=NewId-12345, NewId-12345"
$item.update()
//Check in once changes are completed
$item.File.CheckIn("DocId changed and document checked in")
Note- Once the Document Id is modified, a search crawl (incremental is sufficient) is required in order to associate the changes with the document, else you will get errors when clicking on the Document Id.
Comments:
- I tried this in my SharePoint Online tenant site, but not working. Can you share updated code for Online Management Shell ? Im using Document ID and came across a case where need to change it.
anon 13 Mar 2020 20:00:04 GMT
- not working in SharePoint Online
anon 27 Jan 2019 05:12:10 GMT
- Further comments disabled!
More Posts related to SharePoint,
- error CAML Query containing special characters
- [Solved] SharePoint Illegal operation attempted on a registry key that has been marked for deletion
- Trigger Flow on selected Listitem from SharePoint view - create button with JSON column formatting
- SharePoint Excel error - The workbook cannot be opened because it contains the following features that are not supported by Excel in the browser
- Send Email with attachment using SharePoint PowerShell, SMTP server
- How to show or hide columns in SharePoint Online List Library from
- SharePoint excel error - A problem occurred while connecting to the server. If the problem continues, contact your administrator.
- How to get SharePoint Online user details from person or group column using REST API
- How to get SharePoint List Item URL using PowerShell
- How to get the SharePoint Tenant Login URL
- Special character & not working with SharePoint REST API
- How to disable SharePoint subsite creation option for owners
- Managed Metadata error - The data returned from the tagging UI was not formatted correctly
- Deploy SharePoint wsp solution package using PowerShell
- How to create classic site in SharePoint Online
- See actual SharePoint error exception modify web.config
- 'Edit Document' Requires a Windows Sharepoint Services-compatible application and Microsoft Internet Explorer 6.0 or higher
- How to enable anonymous public access for SharePoint Online site collection, file, folder without login ?
- SharePoint installation error - Setup is unable to proceed due to the following error This product requires Microsoft .Net Framework 4.5
- How to add animated Gif to SharePoint Online Page
- [Solved] SharePoint Search Internal server error exception
- How to create SharePoint Document Library
- SharePoint - Use Today's Date Time in list view filter and calculated column
- How to redirect SharePoint Site Collection to different URL
- SharePoint error cannot connect to the configuration database
More Posts:
- How to Gracefully Close Jupyter Notebook - Python
- Mac turn dark mode on or off using terminal command - MacOS
- Android Development - How to switch between two Activities - Android
- How do I get a list of all branches in Git? - Git
- Python: Access Environment Variables - Python
- Calculate days between dates using dateutils ddiff command - Linux
- auth_client_using_bad_version_title : Error Android Lint - Android
- How to Download Jira App for Mac - Jira