1
votes

The permissions endpoint https://dev.onedrive.com/resources/permission.htm is supposed to return the roles of user also. For one drive folders it is working fine.

But when using it against a sharepoint document library/folder, except for the owner, there is no role returned for other users who the library/site/folder is shared with.

Example Permissions call,

https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w5f-XJRCqSESr32g08dO6nF/root:/%2F:/permissions

Output, (As you can see the role is not provided for most of the permissions). Is this known limitation, any idea of getting sharepoint roles for users/group like 'Full Control', 'Design' for sharepoint resources through one drive api. Thanks.

{
"@odata.context":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/$metadata#permissions",
   "value":[
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNjMzNjg2Ng",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNjMzNjg2Ng",
         "grantedTo":{
            "user":{
               "displayName":"c:0-.f|rolemanager|s-1-5-21-4057271854-771539223-3591658312-6336866"
            }
         },
         "id":"YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNjMzNjg2Ng",
         "roles":[
            "write"
         ]
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNDIzNDYwNw",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNDIzNDYwNw",
         "grantedTo":{
            "user":{
               "displayName":"Company Administrator"
            }
         },
         "id":"YzowLS5mfHJvbGVtYW5hZ2VyfHMtMS01LTIxLTQwNTcyNzE4NTQtNzcxNTM5MjIzLTM1OTE2NTgzMTItNDIzNDYwNw",
         "roles":[
            "write"
         ]
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8Ym9vYm9vc2FpX291dGxvb2suY29tI2V4dCNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8Ym9vYm9vc2FpX291dGxvb2suY29tI2V4dCNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "grantedTo":{
            "user":{
               "id":"11a04758-0129-4c1f-b946-bf159642294e",
               "displayName":"[email protected]"
            }
         },
         "id":"aTowIy5mfG1lbWJlcnNoaXB8Ym9vYm9vc2FpX291dGxvb2suY29tI2V4dCNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20"
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjFAdmVyYWRvY3MuY29t",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjFAdmVyYWRvY3MuY29t",
         "grantedTo":{
            "user":{
               "id":"54f584b5-6627-4137-93f2-a93829a5a750",
               "displayName":"Dev 1 Admin"
            }
         },
         "id":"aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjFAdmVyYWRvY3MuY29t"
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjJAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjJAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "grantedTo":{
            "user":{
               "id":"b49ac078-e9e5-4f39-b1ae-22fd7cc4018b",
               "displayName":"Dev 2 User"
            }
         },
         "id":"aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjJAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20"
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20",
         "grantedTo":{
            "user":{
               "id":"a6748562-1bbe-436d-ab3a-ac9ff41a80c6",
               "displayName":"Dev 3 User"
            }
         },
         "id":"aTowIy5mfG1lbWJlcnNoaXB8ZW5ndXNlcjNAdmVyYWVuZ2Vudi5vbm1pY3Jvc29mdC5jb20"
      },
      {
         "@odata.type":"#oneDrive.permission",
         "@odata.id":"https://veraengenv.sharepoint.com/SarvaTestSite/_api/v2.0/drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8c2FyYXZhLWFkbWluQHZlcmFlbmdlbnYub25taWNyb3NvZnQuY29t",
         "@odata.editLink":"drives/b!vZn4gvPZgEGfRWFQYbih6mFCzVktIRBNhZu_RwyO_w6wxB2Rrk8mRbLphnvO21K7/items/01FNR6N36IKZB5VPZ62FAJUOJRMKC4O4KL/permissions/aTowIy5mfG1lbWJlcnNoaXB8c2FyYXZhLWFkbWluQHZlcmFlbmdlbnYub25taWNyb3NvZnQuY29t",
         "grantedTo":{
            "user":{
               "id":"1e3b97eb-0d8e-438e-af34-6873a92a37bb",
               "displayName":"Saravanan Admin"
            }
         },
         "id":"aTowIy5mfG1lbWJlcnNoaXB8c2FyYXZhLWFkbWluQHZlcmFlbmdlbnYub25taWNyb3NvZnQuY29t"
      }
   ]
}
1

1 Answers

4
votes

You asked two questions here.

1) Roles not showing up in the response is a known limitation of the OneDrive API for business accounts. We are rolling out a fix and it should be available to all callers soon.

2) OneDrive API returns 'read/write' roles if the sharing operation used simplified roles('view', 'edit'). By default, the new OneDrive sharing dialog only lets you select from these simplified roles. However, if the sharing operation happened through the advanced(legacy) sharing workflow, then the OneDrive API will return the corresponding roles('Full Control', 'Design' etc). You can try to share using advanced sharing workflow as follows:

  • Click ellipsis (...) next to the item you want to share
  • Click on the option that says 'Details'
  • Expand the 'Sharing' dropdown in the navigation pane that opens on the left after you click 'Details'.
  • Click 'Advanced'.

Now try using the OneDrive permissions API and the response should contain the advanced roles, prefixed with SP e.g. 'SP.Design'.