Permissions Not Visible in SharePoint Document Library Files Despite Being Set via Microsoft Graph API

ritu123 0 Reputation points
2024-12-19T08:48:28.4566667+00:00

Hi everyone,

I’m working on a C# application using the Microsoft Graph API version 4.51.0 to manage permissions in a SharePoint site’s document library Files. The code successfully sets permissions programmatically, we also getting destination permission id as response but the changes are not reflected when checking the permissions in the SharePoint UI.

Here’s the code I’m using to set the permissions:

IDriveItemInviteRequest permissionRequest = SelectedDrive.Items[DestinationDriveId] .Invite(destinationUserPermissions, true, destinationPermissionRoles, false, null) .Request(); IDriveItemInviteCollectionPage invites = MicrosoftHelper.InvokeApiCall(() => { return permissionRequest.PostAsync().Result; }, this);

  • SelectedDrive and DestinationDriveId are correctly initialized.
  • destinationUserPermissions is a list of recipients (emails).
  • destinationPermissionRoles contains roles like "write" or "read".
  • MicrosoftHelper.InvokeApiCall is a helper to handle API calls and exceptions.

The issue: The API response indicates that permissions are being applied successfully (no errors or exceptions). However, when I check the SharePoint document library permissions in the UI, the changes are not visible.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,658 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yakun Huang-MSFT 8,355 Reputation points Microsoft Vendor
    2024-12-19T10:11:34.36+00:00

    Hello ritu123,

    Thank you for reaching out to Microsoft Support!

    For your problem, we have conducted a test, the work is very good, the test results are as follows:

    Screenshot 2024-12-19 100629

    User's image

    Check whether the invited user has received the invitation email.

    User's image

    Reference Document:

    https://learn.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-1.0&tabs=http

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments

  2. ritu123 0 Reputation points
    2024-12-23T04:17:35.8133333+00:00

    Hi Yakun Huang-MSFT,

    Thank you for your response.

    I have tried using the following request to set site permissions: POST /sites/{siteId}/drive/items/{itemId}/invite

    While the request appears to execute successfully, the changes are not reflected when I check the permissions in the SharePoint UI.

    I have attached a screenshot for your reference. Please have a look.

    permission_issue.jpeg

    Thank you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.