ApplyProvisioningTemplate ConetntType Required field issue
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
During the deployment one of our sharepoint online site templates, we are struggling with the following issue:
List conetnt types that derive from the parent custom content types loses the required field property. In the result, after the deployment, all required fields that derive from custom content types are optional.
Unfortunately, I was not able to reproduce this issue in newly created sites. However, I have found the reason why this is happening. In some scenarios, Load method of the ClientContent returns different results, depending on how the data is loaded.
The following screenshot shows the implementation of the UpdateFieldRef method in the PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance class, during deployment of the site template:
Second screenshot shows modified version (line 955) of the same method, in this case all content types are created correctly:
As you can see in the first case, Reuired property in listField is set to true, which is an invalid value, resulting in the field not being updated in the newly created list.
After some investigation, I have found that in this particular case, Sharepoint API returns different results, depending on if SelectAllProperties is set to true or false.
The same issue occurs using the Invoke-PnPSiteTemplate from the PnP PowerShell module.
I was not able to find similar topic. However, if it is more common issue, maybe it would be good to change the implementation of the UpdateFieldRef method. This change should not affect the way how the method works in other scenarios, but it will fix the issue described above.
Thanks for your help.
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 with the UpdateFieldRef method in the PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance class, around line 955, and compare how ClientContent is loaded with SelectAllProperties enabled and disabled. Reproduce the provisioning scenario if possible and verify that derived content-type fields retain their required setting after deployment, including through Invoke-PnPSiteTemplate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100