Skip to content

SharePoint Embedded assign permissions to container to an Azure AD group #9805

Description

@mick-anderson24

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

other (enter in the "Additional environment details" area below)

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • Microsoft.graph SDK

Describe the bug / error

Using the graphServiceClient I am attempting to add permissions to a SharePoint embedded container to an Azure AD group. The examples and the documentation on the Graph API don't have examples and nothing says it isn't possible to assign a group to the sharepoint embedded container. Below is the executing code:

`var requestBody = new Permission
{
Roles = new List
{
"writer"
},
GrantedToV2 = new SharePointIdentitySet
{
Group = new Identity
{
Id = "17d4e352-2cff-41e8-902a-96ad2f33f3d0"
},
}
};

try
{

var permission = await _graphServiceClient.Storage.FileStorage.Containers[$"{id}"].Permissions.PostAsync(requestBody);
var p = permission;

}
catch(Exception ex)
{
var exception = ex;
}`

The exception I am seeing is: 'userPrincipalName' is required.
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.d__28.MoveNext()
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.d__201.MoveNext() at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__201.MoveNext()
at Microsoft.Graph.Storage.FileStorage.Containers.Item.Permissions.PermissionsRequestBuilder.d__7.MoveNext()

Steps to reproduce

  1. Ensure you have the graphServiceClient configured and granted permissions with scopes "FileStorageContainer.Selected"
  2. Execute the following code: `var requestBody = new Permission
    {
    Roles = new List
    {
    "writer"
    },
    GrantedToV2 = new SharePointIdentitySet
    {
    Group = new Identity
    {
    Id = "17d4e352-2cff-41e8-902a-96ad2f33f3d0"
    },
    }
    };

try
{

var permission = await _graphServiceClient.Storage.FileStorage.Containers[$"{id}"].Permissions.PostAsync(requestBody);
var p = permission;

}
catch(Exception ex)
{
var exception = ex;
}`
3. See exception

Expected behavior

I would expect to be able to assign permissions to an Azure AD group to a Sharepoint embedded container. This is to allow all the members of the group permissions to the files in that container.

Metadata

Metadata

Assignees

Labels

Needs: Author FeedbackAwaiting response from the original poster of the issue. Marked as stale if no activity for 7 days.Needs: Triage 🔍Awaiting categorization and initial review.sharepoint-developer-supportsharepoint-developer-supporttype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions