Started seeing the issue again (2nd time since January). CreateGroupEx endpoint accepts parameters, creates group but it won't create SPO site yet. As a result it returns null for siteurl in the response. After a very long time (sometimes 15-45 mins) the site in SharePoint gets created.
Any version of the PnP does the same which uses this CreateGroupEx to create sites.
Category
[ x] Bug
[ ] Enhancement
Environment
[ x] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013
Expected or Desired Behavior
Today if we like to create Office 365 Groups via SharePoint online then we are using CreateGroupEx api. This api is supposed to provision group resources and also a SharePoint site collection. As a result it should return group id and site url in the response.
Observed Behavior
At the moment when we call this API we see that group is being created and returns only groupid in the response. We see SharePoint site is not created yet, it takes long time to provision. Which resulted the siteUrl as null in the response for API.
Steps to Reproduce
Call the rest api CreateGroupEx with parameters, the request will be 200. But actually only group is being created, but site is not. siteurl is showing null in the response.
Please let me know if anyone else is using this API and any other recommendations to create groups via end point.
Probably @gautamdsheth uses this as he committed with the createModernTeamSite method?
Maybe some long polling mechanism should be applied to the helper before calling /_api/GroupSiteManager/CreateGroupEx after API responded that team site is created.
Probably @gautamdsheth uses this as he committed with the createModernTeamSite method?
Maybe some long polling mechanism should be applied to the helper before calling/_api/GroupSiteManager/CreateGroupExafter API responded that team site is created.
This is not because of recent commits. This is the issue with API itself. I am doubting the issue here is SharePoint site provisioning is taking longer than usual, so API is not waiting till site provision complete. So, returning null for siteUrl property. For clarification yes, it is part of createModernTeamSite (internally it uses this API).
I'm also not saying that it's because of any changes in the library but an external behavior.
Can you check this in different tenants ? I tested it 2 days back in first release tenants and it worked fine. Not sure if we can do anything from our end in the pnpjs library. If it's a Microsoft issue, which seems likely given that it appeared suddenly in your case, would suggest that you open an issue in the sp-dev-docs issue list. If it's very urgent and is stopping your work, would suggest that you open a support ticket or premier ticket with Microsoft, maybe they will have a better idea about it and will be able to resolve it faster.
Perhaps use the following endpoint to poll for status?
https://s-kainet.github.io/sp-rest-explorer/#/_api/spsitemanager/Status
Should be this one for a modern team site:
https://s-kainet.github.io/sp-rest-explorer/#/_api/groupsitemanager/GetSiteStatus
Hey I've provided a possible fix #741. Let me know if this is good.
It uses the _/_api/GroupSiteManager/GetSiteStatus_ endpoint to poll for the status, when the sitestatus is 2 we can be assured that the site is ready.
Can you check this in different tenants ? I tested it 2 days back in first release tenants and it worked fine. Not sure if we can do anything from our end in the pnpjs library. If it's a Microsoft issue, which seems likely given that it appeared suddenly in your case, would suggest that you open an issue in the sp-dev-docs issue list. If it's very urgent and is stopping your work, would suggest that you open a support ticket or premier ticket with Microsoft, maybe they will have a better idea about it and will be able to resolve it faster.
I see the issue in 2 tenants. It is Microsoft issue. I thought we can tag someone from Microsoft to look into the issue as a reference. I will try to create premier ticket with Microsoft as there is nothing wrong with PnP. This is just for awareness too who uses these methods.
@praveenbattula - can you have a look at my commends in PR #741. Just getting a chance to circle back on some of these things and not understanding fully the use case here. The delay in creating groups is a known thing and not something we can "fix" as such in this library. We could merge the PR to add the code to wait for the site, but if it does take 20 minutes I am not sure what practical value that has for users?
Going to close this due to inactivity and the discussions in #741.
Most helpful comment
Perhaps use the following endpoint to poll for status?
https://s-kainet.github.io/sp-rest-explorer/#/_api/spsitemanager/Status
Should be this one for a modern team site:
https://s-kainet.github.io/sp-rest-explorer/#/_api/groupsitemanager/GetSiteStatus