0

We have been having a problem in granting users permissions on certain documents in SharePoint using graph API

The Idea is to use /sites/{siteId}/drive/items/{itemId}/invite graph API to grant users permission on document level, we have followed the instructions as stated in [this][1] Microsoft Documentation and the API call works fine for internal users in our tenant but when we try it out with external user it fails and show us this error in the API response "One or more users could not be resolved"

below is an example of the API call https://graph.microsoft.com/v1.0/sites/{SiteID}/drive/items/{ItemId}/invite body:

{
  "requireSignIn": true,
  "sendInvitation": true,
  "roles": [ "read"],
  "recipients": [
    {"email":"{externalEmailValue}"}
  ]
}

Headers:
Authorization: bearer {token}

any idea why it is not working for external users? the Azure App used for generating the token is configured correctly, and the API call works fine for internal users [1]: https://learn.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-1.0&tabs=http

  • Try isolating the issue by making the above call in POSTMAN/Graph Explorer as well to see if it works correctly or not. Also check the documentation as it talks about what you need to do for users outside of organization as well. – Dev Jun 19 '21 at 18:35

1 Answers1

0

For us it worked once we used the upn instead of email (for both internal and external users)

Andreea
  • 11
  • 1