0

I have created CI/CD for sharepoint Online in Azure DevOps.

I am using PnP provisioning template to deploy changes in Page Layout files from development to QA & Prod environment. Using Apply-PnPProvisioningTemplate.

Example of template file:

  <pnp:Files>
    <pnp:File Src="src\_catalog\masterpage\html\TestPageLayout.html" Folder="{masterpagecatalog}" Overwrite="true" ></pnp:File>
  </pnp:Files>

TestPageLayout.html:

This file contains mso:ContentTypeId, mso:PublishingAssociatedContentType etc based on site collection (for example Dev, UAT, Prod). Every site collection have different ContentTypeId & PublishingAssociatedContentType.

If I select a single file (with specific ContentTypeId & PublishingAssociatedContentType) for each sitecollection (Dev, UAT,Prod) & run Apply-PnPProvisioningTemplate, it will break the page layout in other environment because every environment have different ContentTypeId & PublishingAssociatedContentType.

If I have same contenttypeid for used "site content type" (eg. TestContentType) in all environment, so same TestPageLayout.html can work in all environment but ContentTypeId is readOnly & can't change for "Site Content Type". Useful link : https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ms460737(v=office.15) & https://social.technet.microsoft.com/wiki/contents/articles/31444.sharepoint-online-content-types-in-powershell-edit.aspx

Other option is change Template file and add property attribute for PageLayout as below: https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/Provisioning/BaseTemplates/Common/Publishing-Feature-Native-Files.xml

For Dev,Prod & UAT:

Same as above with correct value of ContentTypeId & PublishingAssociatedContentType.

In this approach, I have to manage three different template file based on environmet & manage Release pipeline to call different template file for each environment.

Can anyone please suggest another way to manage ContentTypeId & PublishingAssociatedContentType in Page Layout if deploying in different environment ?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.