Updating a field "_dlc_DocId" giving 'Access id denied'
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
I'm applying a template and when is on SiteFields updating the field "_dlc_DocId" (ae3e2a36-125d-45d3-9051-744b513536a6) is giving "Access is denied"
This internal field should be updated?
How can I validate if this field can be updated or skipped?
The differences between fields are attributes Version="2" and the SourceID="1234567890", and is only updating the field because of this.
I changed the code to remove the attribute "Version" for the "equalityComparer" between them to skip but since the SourceID is also different, is trying to update the field attributes. How can I validate for skipping this kind of field?
Instead of throwing an exception for this when giving "access is denied" should I validate the type of error and show a warning?
Field from SharePoint
<Field ID="{ae3e2a36-125d-45d3-9051-744b513536a6}" Type="Text" DisplayName="Document ID Value" Name="_dlc_DocId" Required="FALSE" ReadOnly="TRUE" Sealed="TRUE" Description="The value of the document ID assigned to this item." ShowInDisplayForm="FALSE" ShowInListSettings="FALSE" ShowInVersionHistory="FALSE" ShowInViewForms="FALSE" Indexed="TRUE" SourceID="{7e779ff5-6db1-4f4d-867e-3c32d1ace633}" StaticName="_dlc_DocId" Version="2" />
Fields from Template
<Field ID="{ae3e2a36-125d-45d3-9051-744b513536a6}" Type="Text" DisplayName="Document ID Value" Name="_dlc_DocId" Required="FALSE" ReadOnly="TRUE" Sealed="TRUE" Description="The value of the document ID assigned to this item." ShowInDisplayForm="FALSE" ShowInListSettings="FALSE" ShowInVersionHistory="FALSE" ShowInViewForms="FALSE" Indexed="TRUE" SourceID="{4a5d4f64-1d82-4af9-98a5-6e5680abc5e6}" StaticName="_dlc_DocId" />
Exception given
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) | Reason: (ServerUnauthorizedAccessException) Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) --- StackTrace: at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent) at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent) at PnP.Framework.Provisioning.ObjectHandlers.ObjectField.UpdateField(Web web, String fieldId, XElement templateFieldElement, PnPMonitoredScope scope, TokenParser parser, String originalFieldXml) at PnP.Framework.Provisioning.ObjectHandlers.ObjectField.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in PnP.Framework/Provisioning/ObjectHandlers/ObjectField.UpdateField, identified in the stack trace, and trace how template field XML is compared with the existing SharePoint field. Reproduce the _dlc_DocId case using the provided field definitions and determine the expected handling for read-only or sealed fields, including whether completion means skipping the update or reporting a warning instead of the access-denied exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100