I have a service that creates a Sharepoint Online site using CSOM.
context.Web.Webs.Add(webCreationInformation);
context.ExecuteQuery();
This site is created using a defined Template stored in the solutions of the Site Collection. However, the creation of the site can take its time: from 5 minutes to 20 minutes for the site to be ready (all lists created, all views, etc.) Since my ExecuteQuery always returns at 5 minutes (generally with a 503 error) it is impossible for me to know when the site has finished the creation process.
Is there a way to know when the site is available?
I have tried loading the Web object, and even if its not ready, I can load it without problems:
Web sourceWeb = context.Site.OpenWeb(webRelativeUrl);
context.Load(sourceWeb);
context.ExecuteQuery();
//this returns the Web even if the site has not finished the creation process
I would like to have something like:
While(!web.IsReady)
{
Thread.Sleep(60000); //60 seconds
context.Load(web, w => w.IsReady);
context.ExecuteQuery();
}
However, I can't seem to find any flag or value that can help me for this.
Thank you.