0

I try to connect to msgraph to read data with msgraphClientV3 from a spfx webpart.

I followed this :
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis

I want to get result from /me/memberOf endpoint. I added these in my packageSolution File :

"webApiPermissionRequests": [
  {
    "resource": "Microsoft Graph",
    "scope": "User.Read"
  },
  {
    "resource": "Microsoft Graph",
    "scope": "User.ReadBasic.All"
  },
  {
    "resource": "Microsoft Graph",
    "scope": "Directory.Read.All"
  }
]

and call it with :

context.msGraphClientFactory
  .getClient("3")
  .then((client: MSGraphClientV3): void => {
    client.api('/me/memberOf')
      .get((error, messages: any, rawResponse?: any) => {
        console.log("***********result*********")
        if (error)
          console.log(error)
        else
          console.log(messages?.value);
      })
  })

when I try I have this error message :

Error: Insufficient privileges to complete the operation.

Anyone know where I make a mistake ?

Eldrad95
  • 35
  • 5

1 Answers1

0

For the above-mentioned permissions Admin grant is required for that permission to be accepted for that application:

enter image description here

It should be green tick marked when the permission is granted for this check in portal once:

enter image description here

Mehtab Siddique
  • 556
  • 1
  • 2
  • 5