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
Additional environment details
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
- Ensure you have the graphServiceClient configured and granted permissions with scopes "FileStorageContainer.Selected"
- 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.
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
Additional environment details
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
{
}
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__20
1.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
{
Roles = new List
{
"writer"
},
GrantedToV2 = new SharePointIdentitySet
{
Group = new Identity
{
Id = "17d4e352-2cff-41e8-902a-96ad2f33f3d0"
},
}
};
try
{
}
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.