PnP-Sites-Core icon indicating copy to clipboard operation
PnP-Sites-Core copied to clipboard

[BUG] Provisioning document library is stuck at document set content types used in previous provisioning template

Open abhitalks opened this issue 4 years ago • 1 comments

Which PnP repository should you use to report the issue?

  • Not sure if this is an issue with the provisioning schema or the provisioning engine. So reporting at PnP-Sites-Core

Environment

[x] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

Idempotency. Every provisioning execution should provision a document library in exactly the way it is specified in the provisioning template.

Observed Behavior

After having provisioned a few document libraries with document set and its associated content types, the subsequent provisioning for a regular document library results in provisioning of document set content types as used in the previous provisioning template.

Steps to Reproduce

1. Used this template snippet to provision few document libraries configured with Document Set:


<pnp:ListInstance Url="{Parameter:DocLibUrl}" Title="{Parameter:DocLibTitle}" 
	Description="{Parameter:DocLibDesc}" 
	DocumentTemplate="{site}/{Parameter:DocLibUrl}/Forms/template.dotx" 
	TemplateType="101" 
	EnableVersioning="true" MinorVersionLimit="0" MaxVersionLimit="500" DraftVersionVisibility="0" 
	ContentTypesEnabled="true" RemoveExistingContentTypes="true" 
	TemplateFeatureID="00bfea71-e717-4e80-aa17-d0c71b360101" 
	EnableAttachments="false" 
	DefaultDisplayFormUrl="{site}/{Parameter:DocLibUrl}/Forms/DispForm.aspx" 
	DefaultEditFormUrl="{site}/{Parameter:DocLibUrl}/Forms/EditForm.aspx" 
	DefaultNewFormUrl="{site}/{Parameter:DocLibUrl}/Forms/Upload.aspx" 
	ImageUrl="/_layouts/15/images/itdl.png?rev=47" 
	IrmExpire="false" IrmReject="false" IsApplicationList="false" ValidationFormula="" ValidationMessage="">

	<pnp:ContentTypeBindings>
		<pnp:ContentTypeBinding ContentTypeID="0x010100E6F3CBD220ED6D4591B6630735712D2F04" Default="true" />
		<pnp:ContentTypeBinding ContentTypeID="0x0120" />
		<pnp:ContentTypeBinding ContentTypeID="0x0120D52000E4862500592F934081CB2B921E2AEBB8" />
	</pnp:ContentTypeBindings>

	<pnp:Views>...</pnp:Views>
	<pnp:FieldRefs>...</pnp:FieldRefs>
	<pnp:Folders>...</pnp:Folders>
	<pnp:Security>...</pnp:Security>

</pnp:ListInstance>

Content types are the "document set" content type and one "allowed content type" of that document set.

Expected Behaviour: A document library is provisioned as a Document Set with relevant content types. Resulting Behaviour: Success

2. Afterwards, used this template snippet to provision a new regular document library:


<pnp:ListInstance Url="{Parameter:DocLibUrl}"
	OnQuickLaunch="false" TemplateType="101"  
	EnableVersioning="true" MinorVersionLimit="0" MaxVersionLimit="500" DraftVersionVisibility="0" 
	ContentTypesEnabled="true" RemoveExistingContentTypes="true" 
	TemplateFeatureID="00bfea71-e717-4e80-aa17-d0c71b360101" 
	EnableAttachments="false" EnableFolderCreation="false" 
	DocumentTemplate="{site}/{Parameter:DocLibUrl}/Forms/template.dotx" 
	DefaultDisplayFormUrl="{site}/{Parameter:DocLibUrl}/Forms/DispForm.aspx" 
	DefaultEditFormUrl="{site}/{Parameter:DocLibUrl}/Forms/EditForm.aspx" 
	DefaultNewFormUrl="{site}/{Parameter:DocLibUrl}/Forms/Upload.aspx" 
	ImageUrl="/_layouts/15/images/itdl.png?rev=47" 
	Title="{Parameter:DocLibTitle}" Description="{Parameter:DocLibDesc}" 
	IrmExpire="false" IrmReject="false" IsApplicationList="false" ValidationFormula="" ValidationMessage="">
	
	<pnp:ContentTypeBindings>
		<pnp:ContentTypeBinding ContentTypeID="0x010100E6F3CBD220ED6D4591B6630735712D2F05" Default="true" />
	</pnp:ContentTypeBindings>

	<pnp:Views>...</pnp:Views>
	<pnp:Security>...</pnp:Security>
	
</pnp:ListInstance>


Expected Behaviour: A document library is provisioned as a regular document library with one content type as specified in the template. Resulting Behaviour:

  1. Document library is partially provisioned, but with the content types from the document set. The "document set" content type as well as the "allowed content type" in document set. Even includes the view defined in the document set. This is exactly like the one used in the earlier provisioning template.

  2. The content type specified in this template is also added in addition to the document set content types.

  3. The Url property is being ignored and the document library is provisioned using Title instead of Url.

  4. PowerShell script throws error:

    Apply-PnPProvisioningTemplate : The content type "xxx" at "site" is read only. + CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException

The content type "xxx" in error message is the allowed content type in document set. Looks like it is trying to remove existing content types as specified in the template (RemoveExistingContentTypes="true"), but that one is marked as read-only.

3. I tried changing the template to remove contenttypebindings, views, security, and other sections.

Expected Behaviour: A document library is provisioned as a regular document library with the default document content type. Resulting Behaviour: No errors this time. But, end result is that the document library is provisioned with document set with the document set content types from the earlier provisioning, same as in step 2 above.

Question

  1. Why are my subsequent provisioning ending up as document set from the preceding provision? Is it picking up the previously used content types from somewhere else? Where?
  2. Why is Url property being ignored and the document library provisioned using Title instead of Url?

abhitalks avatar Jul 30 '20 15:07 abhitalks

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Jul 30 '20 15:07 ghost