I have Document ID Service enabled in my SPO site.
1- Is it possible to specify a custom Document ID when uploading a document using the Graph API?
2- If not, is it possible to overwrite the Document ID after uploading the document?
3- If not possible either, how do I assign a Document ID using CSOM or REST?
For example, I tried the following without success (I get: Forbidden - Field '_dlc_DocIdUrl' is read-only):
var guid = Guid.NewGuid().ToString();
var listItem = new ListItem
{
Fields = new FieldValueSet
{
AdditionalData = new Dictionary<string, object>()
{
{ "_dlc_DocIdUrl", $"https://some_domain.sharepoint.com/_layouts/15/DocIdRedir.aspx?ID={guid}&{parentPath}" }
}
}
};
await graphServiceClient.Sites[siteId].Lists[listId].Items[itemId]
.Request()
.UpdateAsync(listItem);
PS: I also tried manually editing the Document ID directly in SPO and was not able to. Other fields show as editable, but Document ID seems to be read-only.