How to find which site designs have been applied on a SharePoint site.

In SharePoint Online, a new provisioning process is being used which allows an administrator to define a set of designs that can be applied to a newly created site. These site designs consist of the ability add column, lists, specify themes, apply SPFx solutions and more.

It’s important to note that multiple site designs can be applied to a site in SharePoint online.

How site designs can be applied to a site collection

  • During creation of a new site using the SharePoint UI
  • During the association to a hub site
  • Invoking on an existing site using Invoke-SPOSiteDesign and Add-SPOSiteDesignTask

Because site designs can be applied in multiple ways and more than one site design can be applied to a site, an admin may want to have a way to see which site designs have been invoked onto a site.

Introducing Get-SPOSiteDesignRun (PowerShell)

Get-SPoSiteDesignRun is a new command available to the SharePoint Online Management Shell that will show which site designs have been applied to a specific site collection.

$siteDesignsRan = Get-SPOSiteDesignRun -WebUrl "https://yoursite.sharepoint.com/sites/testsite"

Id                : e4ff3264-c7b1-4121-b179-445382216703
SiteDesignId      : d082fc0e-9a49-4675-88ac-d49e0931670e
WebId             : 42a2b14c-ce2a-485e-8854-92d3b334704f
SiteId            : f848c5a3-9c6b-40f6-becd-8c5661f0e558
SiteDesignVersion : 1
SiteDesignTitle   : Long Site Design

Id                : 8efb3528-3ff1-4dcf-98a3-7f020492a79f
SiteDesignId      : d082fc0e-9a49-4675-88ac-d49e0931670e
WebId             : 42a2b14c-ce2a-485e-8854-92d3b334704f
SiteId            : f848c5a3-9c6b-40f6-becd-8c5661f0e558
SiteDesignVersion : 1
SiteDesignTitle   : Long Site Design

Id                : 00000000-0000-0000-0000-000000000000
SiteDesignId      : 7da58b45-b11d-4e3c-940b-a96c925d02be
WebId             : 42a2b14c-ce2a-485e-8854-92d3b334704f
SiteId            : f848c5a3-9c6b-40f6-becd-8c5661f0e558
SiteDesignVersion : 1
SiteDesignTitle   : MMD Test

Notice the first two site designs that were run, are actually the same. This is because not only does this command show all site designs applied, it also shows the history of invocations against this site collection. Using Invoke-SPOSiteDesign or Add-SPOSiteDesignTask. More information on Add-SPOSiteDesignTask can be found in my previous post.

Needing more information

Get-SPOSiteDesignRun is a valuable command, but as an administrator you may not know what each site design has implemented and the history of actions taken in the site collection. To do this, you can use the new Get-SPOSiteDesignRunStatus command and it will return the result of each action from every site script in your site design.

In the command above, I got a list of site designs that have been invoked onto a site collection and stored them in an object called $siteDesignsRan. I can use the Get-SPOSiteDesignRunStatus command to find more information about each site design invocation.

Get-SPOSiteDesignRunStatus -Run $siteDesignsRan[1]

OrdinalIndex    : 0
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 0
ActionTitle     : Create site column MyTestMMD2TaxHTField through XML
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : Success
OutcomeText     : 

OrdinalIndex    : 1
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 1
ActionTitle     : Create site column MyTestMMD2 through XML
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : Success
OutcomeText     : 

OrdinalIndex    : 2
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 2
ActionTitle     : Create content type Test CT
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : NoOp
OutcomeText     : 

OrdinalIndex    : 3
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 2
ActionTitle     : Add site column MyTestMMD2 to content type
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : NoOp
OutcomeText     : 

OrdinalIndex    : 4
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 2
ActionTitle     : Add site column MyTestMMD2TaxHTField to content type
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : NoOp
OutcomeText     : 

OrdinalIndex    : 5
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 3
ActionTitle     : Create or update list Custom List
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : NoOp
OutcomeText     : List with name Custom List already exists.

OrdinalIndex    : 6
SiteScriptID    : 0aa8ce3a-0a7f-4963-bd0f-07ce28a6a5dd
SiteScriptTitle : LongSiteScript
SiteScriptIndex : 0
ActionIndex     : 3
ActionTitle     : Add content type Test CT
ActionKey       : 00000000-0000-0000-0000-000000000000
OutcomeCode     : NoOp
OutcomeText     :

This is a great command that should be in every admin’s toolbox to help manage and govern SharePoint sites. It gives us a very clear history of what actions have been taken on a given site collection and the results of those actions.

If you ever have a question as to which site designs have been applied to your site, look no further than Get-SPOSiteDesignRun and Get-SPOSiteDesignRunStatus.

Using REST

The previous example was showing how to get the Site Designs applied using PowerShell.  Below is how you can get the results using REST.

Get a list of Site Designs ran on a site using REST

(POST) _api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.GetSiteDesignRun

Result

 
   "d": 
      "results": 
          
            "__metadata": 
               "id":"https://testsite.sharepoint.com/sites/test/_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteDesignRun4eb4e8b2-ead5-4f11-a4f9-0d127b898740",
               "uri":"https://testsite.sharepoint.com/sites/test/_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteDesignRun4eb4e8b2-ead5-4f11-a4f9-0d127b898740",
               "type":"Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteDesignRun"
            },
            "ID":"38ef12db-e8b8-4716-96d9-7556c61bf98b",
            "SiteDesignID":"6ebda32f-c2dc-4353-b09c-36df6652dfaa",
            "SiteDesignTitle":"Team Site Design",
            "SiteDesignVersion":1,
            "SiteID":"b6e1bf12-151e-43c7-a889-df7d1759db0f",
            "StartTime":"1535557919000",
            "WebID":"e0a62834-f04f-4f31-b2e1-6c8badf56167"
         }
      ]
   }
}

Get Information about a specific site design using REST

Using the response from the above request, you can grab the ID and pass it as the “runId” parameter to the following endpoint.

(POST) _api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.GetSiteDesignRunStatusAndSchema
fetch("https://testsite.sharepoint.com/sites/test/_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.GetSiteDesignRunStatusAndSchema", {
    "credentials": "include",
    "headers": {
        "accept": "application/json;odata=verbose",
        "accept-language": "en-US,en;q=0.9",
        "content-type": "application/json;odata=verbose",
        "x-requestdigest": "YourXRequestDigest"
    },
    "referrer": "https://testsite.sharepoint.com/sites/test",
    "referrerPolicy": "no-referrer-when-downgrade",
    "body": "{\"runId\":\"38ef12db-e8b8-4716-96d9-7556c61bf98b\"}",
    "method": "POST",
    "mode": "cors"
});

Result

 
   "d": 
      "GetSiteDesignRunStatusAndSchema": 
         "__metadata": 
            "type":"Microsoft.SharePoint.Utilities.WebTemplateExtensions.SPSiteScriptStatusAndSchema"
         },
         "ActionStatus": 
            "__metadata": 
               "type":"Collection(Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptActionStatus)"
            },
            "results": 
                
                  "ActionIndex":0,
                  "ActionKey":"00000000-0000-0000-0000-000000000000",
                  "ActionTitle":"Apply theme Black and Yellow",
                  "LastModified":"1535557920000",
                  "OrdinalIndex":0,
                  "OutcomeCode":0,
                  "OutcomeText":null,
                  "SiteScriptID":"72673672-3708-415d-b7f9-5322288dfa6c",
                  "SiteScriptIndex":0,
                  "SiteScriptTitle":"Apply Theme"
               }
            ]
         },
         "Schema":"{\"recipes\":[{\"actions\":[{\"stages\":[\"Apply theme Black and Yellow\"]}],\"recipeGuid\":\"72673672-3708-415d-b7f9-5322288dfa6c\",\"recipeName\":\"Apply Theme\"}],\"siteDesignTitle\":\"Team Site Design\",\"siteDesignVersion\":1}"
      }
   }
}

 

Hope this helps!

2 thoughts on “How to find which site designs have been applied on a SharePoint site.

  1. Xhina Xhn January 2, 2020 / 1:08 am

    How to know the latest site design applied when you have the results of $siteDesignsRan. Is the last one at the bottom of the result the latest?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s