SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

Getting the below error message while trying to apply a Communication site template to a Team Site - Exception: The parent content type specified by content type identifier 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39 does not exist. #7841

Open JayasmitaMishra opened 2 years ago

JayasmitaMishra commented 2 years ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

other (enter in the "Additional environment details" area below)

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

I am trying to apply a Communication site template to a Team Site via Power Automate and Function App. But the Function is throwing the below exception while executing the command Invoke-PnPSiteTemplate Exception: The parent content type specified by content type identifier 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39 does not exist.

Steps to reproduce

1.Extract the Site Template 2Run the command Invoke-PnPSiteTemplate to apply the site template 3.

Expected behavior

Site Template should get applied.

ghost commented 2 years ago

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

patrikhellgren commented 2 years ago

The content type Id in your exception is the one for Page from the classic publishing infrastructure feature and the parent of that is SystemPage from the same feature. You probabaly have had that feature enabled on the source site at some time. This content type is not available in an out of the box Communication site or Team Site.

It is not really a good idea to apply a template exported from a site with one site template to a destination site with another site template if you haven't cleaned the template manually from unnecessary objects and you will also need to make sure that the same features are enabled in the destination site as in the source site. Also in this case I would say that the classic publishing infrastructure features are not supported in modern sites but I can't find an official statement on this right now so don't quote me on that.

Since this is a template from a Communication site you are probably not using that content type and could safely remove it from the template.

JayasmitaMishra commented 2 years ago

You are right that the Id is of Page Content Type. But in the source site(template), only the below Content Types are listed. Which one should I remove? https://user-images.githubusercontent.com/102665699/160900037-ff3d9822-aceb-4243-9b87-a0e97d208ae1.png

Site Content Type ------ Parent Content Type

patrikhellgren commented 2 years ago

You need to check the xml-template you are trying to apply since that is the one probably containing the erronous content types. Find it there and just comment it out and try to apply it again.