1

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?

0

Actually we solved the problem. The siteCreationOperation has a property named isComplete. Iterate over this and pick up the boolean for further processing :)

https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.tenant.createsite(v=office.15).aspx

#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)
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.