Skip to content

Bug when creating a new group connected site collection? #1567

Open
@LarsThomasNilsson

Description

Category

  • Bug

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" }
};

     SiteCreationOptions siteCreationOptions = new SiteCreationOptions()
     {
         UsingApplicationPermissions = true
     };
     using (var newSiteContext = await pnpContext.GetSiteCollectionManager().CreateSiteCollectionAsync(teamSiteToCreate, siteCreationOptions))
     {
         // Do work on the created site collection via the newSiteContext
     };

}

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.

Metadata

Assignees

No one assigned

    Labels

    area:admin 📜Admin library relatedquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions