0
votes

I have a corporate account set up with OneDrive. I have a "dummy" (proxy?) account set up that has no OneDrive of its own. (I intentionally want this account to have very little privilege - it is set up ONLY as a reader.) I have shared a folder from the corporate account to the dummy account. I would like to use Microsoft Graph using the dummy account to read the files shared with it. How would I go about this? What are the appropriate calls?

When I try "/v1.0/me/drive/sharedWithMe", I get "You do not have access to create this personal site or you do not have a valid license". I really don't want to waste an Office 365 license on this dummy account, but is that the only way? Is it possible to do this via the SharePoint route? If so, how? Is there any other, better way to do what I'm trying to achieve?

Any help would be much appreciated!

2

2 Answers

0
votes

The issue is that /me tries to find the personal site for the caller, and so if they don't have a subscription the request will fail.

Is it possible for you to know the shared item ahead of time? That's really the only way you could make this scenario work I think. In that case you could do one of the following.

Use the API ids
As the owner of the data, make an API request to get the driveId and id of the item. Then as the dummy account make a request like the following:

https://graph.microsoft.com/v1.0/drives/driveId/items/id

Use the SharePoint URL
In this case say the SharePoint URL to the folder was https://tenant-my.sharepoint.com/personal/user_tenant_com/Documents/Folder you could encode it as a share id and make a request like the following to access it:

https://graph.microsoft.com/v1.0/shares/u!aHR0cHM6Ly90ZW5hbnQtbXkuc2hhcmVwb2ludC5jb20vcGVyc29uYWwvdXNlcl90ZW5hbnRfY29tL0RvY3VtZW50cy9Gb2xkZXI/driveItem

0
votes

OK, as explained by Brad, "/me" doesn't work. However, I was able to get this working. Initially I had a "scopes" issue, but once I got that sorted out, I used queries like https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/{folder-path}:/children and... problem solved!