I'm creating a number of sites using a powershell script. Now, when each of the sites is finished, I want to activate features on it.
My problem is that when I do this, it takes some time before the site is ready. Especially in SharePoint Online it is hard to predict when the site is ready. I've tried using time-loops, but I was wondering if there is a status setting somewhere that I can query instead.
Any thoughts?
Actually we solved the problem. The siteCreationOperation has a property named isComplete. Iterate over this and pick up the boolean for further processing :)
#Create the site using the properties
$tenant.CreateSite($properties) | Out-Null
...
...
$siteCreationOperation = $tenant.CreateSite($properties)
$ctx.Load($siteCreationOperation)
...
...
#Create the site in the tennancy
...
...
do
{
...
...
$ctx.Load($siteCreationOperation)
$ctx.ExecuteQuery()
Write-Host $siteCreationOperation.IsComplete
...
...
}
...
while (!$siteCreationOperation.IsComplete)
...