Forum Discussion

BM-HV's avatar
BM-HV
Copper Contributor
Sep 14, 2022

addContentTypesFromHub prevents site script from execution

Hello dear community, I'm currently struggling with something very basic: I would like to apply a site design via REST API to a newly created teamsite.

 

The site script is using "addContentTypesFromHub" to add content types from the content type hub to the site. Afterwards I'm using "addContentType" to register those content types at the "Documents" library.

 

{
    "$schema": "schema.json",
    "actions": [
        {
            "verb": "applyTheme",
            "themeName": "THEMENAME"
        },
		{
			"verb": "addNavLink",
			"url": "URL",
			"displayName": "DISPLAYNAME"
		},        
        {
			"verb": "joinHubSite",
			"hubSiteId": "GUID"
        },
        {
            "verb": "addContentTypesFromHub",
            "ids": [
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A02",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0201",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0203",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020D",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0208",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0202",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0207",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020A",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020C",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0204",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020B",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020E",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0205",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0209",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0206",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A020F",
                "0x0101000DB8D4B86DFC664AA674C413C81BAB6A0210"
            ]
        },
        {
            "verb": "createSPList",
            "listName": "Dokumente",
            "templateType": 101,
            "subactions": [
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                },
                {
                    "verb": "addContentType",
                    "name": "XXX"
                }
            ]
        },
        {
            "verb": "setSiteExternalSharingCapability",
            "capability": "Disabled"
        },
		{
            "verb": "triggerFlow",
            "url": "https://prod-20.germanywestcentral.logic.azure.com:443/workflows/XXX",
            "name": "XXX",
            "parameters": {
                "XXX": "XXX"
            }
        }
    ],
    "bindata": { },
    "version": 1
  }

 

If I apply the site design via SharePoint site settings, everything works fine. However, if I'd like to apply the site design via REST API, the site design isn't applied.

 

_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility.ApplySiteDesign

Body: {"siteDesignId": "GUID", "webUrl": "ROOTLEVELSITE"}

 

If I delete the addContentTypesFromHub-part from the site script, I can apply the site design via REST-API without any problems.

 

Someone else facing the same issue?

No RepliesBe the first to reply

Resources