Hello.
I want to grant permissions to a group on a document library I have created in SharePoint using the MS Graph API.
I can read permissions using:
_graphServiceClient.Drives[driveid].Items[driveid].Permissions.GetAsync();
I can remove permissions using:
_graphServiceClient.Drives[driveid].Items[driveid].Permissions[perm.Id].DeleteAsync();
But when I try to add a group using:
var requestBody = new InvitePostRequestBody {
Recipients = lstRecipients,
RequireSignIn = true,
SendInvitation = false,
Roles = new List<string>() { "write"},
RetainInheritedPermissions = true
};
_graphServiceClient.Drives[driveid].Items[driveid].Invite.PostAsInvitePostResponseAsync(requestBody);
I get the error "invalidRequest"
On the other hand, I can add permissions to an item within a document library using this method (It's just that in this case, I have an item ID different from the drive ID), but I cannot do so for the document library itself.