pnpcore: Cannot connect group to site

Category

  • Bug

Describe the bug

When ‘Site creation’ settings are as follow:

image

And trying to connect a group to a site using the following code:

ConnectSiteToGroupOptions groupConnectOptions = new ConnectSiteToGroupOptions( new Uri(“https://contoso.sharepoint.com/sites/sitetogroupconnect”), “sitealias”, “Site title”); await context.GetSiteCollectionManager().ConnectSiteCollectionToGroupAsync(groupConnectOptions);

I’m getting the following error:

HttpResponseCode: 500 Code: Microsoft.SharePoint.SPException Message: Modern site creation is not allowed. Contact your administrator for more information. ClientRequestId: eb7670a0-8086-5000-8f51-4764e8f75110 SPClientServiceRequestDuration: 142 X-SharePointHealthScore: 2 X-SP-SERVERSTATE: ReadOnly=0 PnP.Core.SharePointRestServiceException: SharePoint Rest service exception at PnP.Core.Services.BatchClient.ExecuteSharePointRestInteractiveAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteSharePointRestBatchAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteBatch(Batch batch) at PnP.Core.Model.BaseDataModel1.RequestAsync(ApiCall apiCall, HttpMethod method, String operationName) at PnP.Core.Model.BaseDataModel1.RawRequestAsync(ApiCall apiCall, HttpMethod method, String operationName) at PnP.Core.Admin.Model.SharePoint.SiteCollectionCreator.CreateSiteUsingSpoRestImplementationAsync(PnPContext context, SiteCreationModel siteCreationModel, Dictionary`2 payload, SiteCreationOptions creationOptions) at PnP.Core.Admin.Model.SharePoint.SiteCollectionCreator.ConnectGroupToSiteAsync(PnPContext contextIn, ConnectSiteToGroupOptions siteToGroupify, CreationOptions creationOptions) at PnP.Core.Admin.Model.SharePoint.SiteCollectionManager.ConnectSiteCollectionToGroupAsync(ConnectSiteToGroupOptions siteGroupConnectOptions, CreationOptions creationOptions)

This works fine when both ‘checkboxes’ are marked in the ‘Site creation’ settings page

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

ok, thanks for the clarification, the text itself in the ‘Site creation’ settings is not understandable

It will be nice to have a clear documentation of what it means

Thanks!