Forum Discussion
SharePoint Online issues creating site collections via PnP code again...
In general you get these error messages when multiple things update the same object.
So typically you could get this error when you create a site collection and while the site collection is being created it is also updated by another process.
So for example if you apply templates to a site twice at the same time. The context of the command giving the error is then not up to date any more as the context isn't updated with updates made by the other process.
In the past I found this error when we had mutliple developers runninng powershell commands applying PnP templates to the same site. We then had to reconnect to the site to bring the context into sync.
The slightly less obvious variations of the same problem occur if your tmeplate include multiple copies of the same object (list, column, contenttype). So during a single application of a template an object is updated twice.
The easiest way to debug the issue I found is either with PowerShell apply a template after having enabled debug (Set-SPOTraceLog) or to step through the code and enable debug on the PnP.
Hopefully the following two artciles will help you:
https://veenstra.me.uk/2016/10/11/office-365-how-do-debug-pnp-powershell-commands/
https://veenstra.me.uk/2016/07/29/office-365-sharepoint-how-to-debug-pnp-provisioning-engine/
Thank you for your response.
I am not using the provisioning engine, just a simple csom call to create a blank team site. There are no other requests to this site during this time.
For me this is clearly a bug in SPO or something changed and the PnP extension needs an update. But since there are probably many others, using this PnP extension, i was wondering if other people have also seen this and maybe opend support cases already and can provide some more information on this topic.
So the way I understand this, there is nothing I can do about it from my code perspective.
- Vel SenthilOct 19, 2016Copper Contributor
I am facing the same issue. In my case, I am using Azure webjob to create the site. This error happens before applying the template.
Here is the stack trace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay)
at Microsoft.SharePoint.Client.TenantExtensions.GetSiteGuidByUrl(Tenant tenant, Uri siteFullUrl)
at Microsoft.SharePoint.Client.TenantExtensions.CreateSiteCollection(Tenant tenant, SiteEntity properties, Boolean removeFromRecycleBin, Boolean wait)- Oliver ZeiserOct 19, 2016Brass Contributor
Yup that is the same issue. I am seeing this at more than 15 customers. But many others are just working fine. And I have the same code running there. So I guess only a few tenants/sharepoint online farms have this issue.
It is a big pain that the key feature of sharepoint online, creating sitecollections, is not working reliable. I am still not quite sure if the issue only shows up with PnP library or also using ootb csom methods. I guess i'll have to check that first before opening one more support case....
- Tero ArvolaJan 16, 2017Copper Contributor
I'm experiencing the same behaviour in at least three tenants (haven't tested more at this point). I'm not using PnP extension methods for creation. The issue seems to come more often when creating multiple site collections in a row, using Azure continuous webjob.