1

I'm writing a script that should apply a site design to a site (large site design).

I can queue the task, but I didn't found a way to wait for the effective completion.

How to do that ?

I use either PnP PowerShell or SPO module, but none seems to provide a wait command.

I trigger the sitedesign using

 $designTask = Add-PnPSiteDesignTask -SiteDesignId 4d95f2a0-b7fa-4102-a4d4-c4a3566f2fd1 
1

1 Answer 1

0

Add-PnPSiteDesignTask command merely schedules a new task. It's "fire and forget".

The workaround for this is to query the target SharePoint site from time to time to see if everything is deployed.

For example, if you know that your site design deploys "My List" at the very last moment, you can check if it exists. If it does, then you can assume that the entire Design task is done:

While($list -eq $null){ try{ $list = Get-PnPList -Identity "My List" }catch{} Write-Host Design task is running. Please wait... Start-Sleep -Seconds 10 } Write-Host Design task completed 
1
  • 1
    I used a similar approach yet, providing a "SiteScriptEnd" column at the very end of my script, and poll for that. Not satisfying but it worked. However, in my very specific case I have to trigger design on sites where it has already been applied (due to some fixes in the design). I'll probably have to dive into sub object to check for fix been applied. Commented Mar 31, 2021 at 6:55

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.