The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
I run
New-MgSitePermission
as mentioned and got the result ID = string, Roles={Write}
In the postman, I got
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('theabudhabichamber.sharepoint.com%2C50cb4d97-ac68-4794-9d22-c5f9555f7a35%2Cca3647e0-f130-4ce4-bfa4-100410e8098a')/permissions",
"value": [
{
"id": "aTowaS50fG1zLnNwLmV4dHxhNTRlY2QwOS0xMzI2LTQ3ZWQtODkxMy05MzZiMDc1OGRlOGFANzVhNmQ5MDctMDE3Ny00ZDVhLTg2YzctZTU1ZWVjMjZiZjVh",
"grantedToIdentitiesV2": [
{
"application": {
"displayName": "ADC-OneDriveShare",
"id": "a54ecd09-1326-47ed-8913-936b0758de8a"
}
}
],
"grantedToIdentities": [
{
"application": {
"displayName": "ADC-OneDriveShare",
"id": "a54ecd09-1326-47ed-8913-936b0758de8a"
}
}
]
}
]
}
But when I try to invoke the first code you gave I got
Invoke-RestMethod: untitled:Untitled-1:19:13
Line |
19 | $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2022-08-16T11:11:08","request-id":"139d8110-10d6-49cc-b8f9-301f34b5cb5d","client-request-id":"139d8110-10d6-49cc-b8f9-301f34b5cb5d"}}}
even though the Access Token value is there, I can call the $headers and see the token "Bearer eyJ0eXAiOiJKV1QiLCJub25jZS....."
Anyway, I dont know if this is the correct results as I am expecting to see a list of users how have access to the site.