Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify if a OneDrive DriveItem permission identity is a group or a user

We are getting the permissions of a driveItem using Microsoft Graph as documented here.

Each returned permission object usually contains a grantedTo field that has an IdentitySet as its value. But the issue with that is that each Identity is always a user:

"grantedTo": { 
    "user": { 
        "displayName": "data Owners", 
        "email": "[email protected]", 
        "id": "94c3e81b-f6fb-43c6-8df5-b98462ccf191" 
    } 
}
"grantedTo": { 
    "user": { 
        "displayName": "Data Members" 
    } 
} 

This occurs even though those are Groups. So there's no way, using this data, to identify with certainty what is a Group and what is a User.

We want to avoid any additional request to do so as this can become quite inefficient.

Thus we are asking is there a way to identify if it is a group or user, without any additional API requests? For example some undocumented query parameters or relationships?

like image 415
smotti Avatar asked Aug 05 '19 05:08

smotti


Video Answer


1 Answers

I'm afraid this isn't possible because the IdentitySet itself doesn't distinguish between Users and Groups:

{
  "application": {"@odata.type": "microsoft.graph.identity"},
  "device": {"@odata.type": "microsoft.graph.identity"},
  "user": {"@odata.type": "microsoft.graph.identity"}
}
like image 145
Marc LaFleur Avatar answered Oct 08 '22 11:10

Marc LaFleur