Open LarsThomasNilsson opened 2 weeks ago
@LarsThomasNilsson : I just tried to reproduce your issue by running on our test cases (https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core.Admin.Test/SharePoint/SiteCreationTests.cs#L940-L1036) and this worked fine using app-only permissions. Can you check that code and verify yours, if you still get an error please post the they payload you're sending to the server
Category
Error when creating new Sharepoint group enabled site collection (first issue reported, hope I did everything right)
Steps to reproduce
When running the follwong code I get a graph exception, "{HttpResponseCode: 400Code: Request_BadRequestMessage: The value of 'odata.bind' property annotation is an empty array. The 'odata.bind' property annotation must have a non-empty array as its value.ClientRequestId
Code: using (var pnpContext = await contextFactory.CreateAsync("SiteToWorkWith")) { var teamSiteToCreate = new TeamSiteOptions("mynewsite", "My new site") { Description = "My site description", Visibility = PnP.Core.Model.Security.GroupVisibility.Public, Owners = new string[] { "xxxx@xxxx.onmicrosoft.com" } };
}
Expected behavior
A new group connected site collection to be created
Environment details (development & target environment)
SDK version**: 1.14
OS: Windows 11
SDK used in:Console App
Framework: .NET 8.0
Tooling: Visual Studio 2022
Additional details: The more context you can provide, the easier it is (and therefore quicker) to help.
Additional context
My Entra ID app has application permssions on Microsoft.Graph Group.Create Group.ReadWrite.All Sites.Fullcontrol.All
My Entra ID app has application permssions on SharePoint: Sites.Fullcontrol.All
It works to create a non group enabled site collection: var teamsite = new TeamSiteWithoutGroupOptions(new Uri(siteUrl), title.ToString()) { Description = description.ToString(), Language = PnP.Core.Admin.Model.SharePoint.Language.Swedish, Owner = owner.ToString(), Title = title.ToString(), SensitivityLabelId = new Guid(azureFunctionSettings.SensitivityLabelIdSite) };
//Get the context to the new site and perform additional config using (var newSiteContext = await pnpContext.GetSiteCollectionManager().CreateSiteCollectionAsync(teamsiteBDO)) {
};
Thanks for all contributions to this SDK! It's great. Sharing is caring.