0

I am coding against the Microsoft Graph CSharp SDK and have implemented a Daemon or Server Application to Web API. The daemon calls a web API, built on OAuth 2.0 client credentials grant type.

I am then creating calls to access specific user's DriveItem Stream.

My Request call:

var driveItemSteam = await graphServiceClient.Drives["test@test.onmicrosoft.com"].Items["01MPVS7H3LTYVLJEAP5ZG2XOZ5EGHI5I4R"].Content.Request().GetAsync();

My question is if there is a way for a daemon application to access a user's Content. Is there something that I am missing from my request call to allow an App level permission to access a specific user's OneDrive for business DriveItem?

jdave
  • 845
  • 2
  • 11
  • 27
  • 3
    Microsoft Graph doesn't yet support app-only scenarios with files. As you have noted, you'll see an error trying to download files from the API when using app-only authentication. Consider adding / voting on adding this via our UserVoice page: https://onedrive.uservoice.com/forums/262982-onedrive/category/89523-developer – Ryan Gregg Feb 21 '17 at 21:55
  • @RyanGregg I am assuming that if I tried to access the `Microsoft.Graph.downloadUrl` that this would not work either? – jdave Feb 21 '17 at 23:21
  • 1
    That's right. The download URLs don't work for app-only access. You can use Microsoft Graph up until that point, although a few other parts of the API also don't work in app-only mode right now. We're working on fixing those issues so we can officially support this authentication style, but I don't have an ETA. – Ryan Gregg Feb 25 '17 at 17:20
  • 1
    You can fall back to using the SharePoint REST API directly when you want to download file, as I've done in this older example: https://github.com/rgregg/onedrive-app-delegate-sample. However, that requires you to get a new access_token for the SharePoint endpoint. – Ryan Gregg Feb 25 '17 at 17:21
  • @RyanGregg I'm trying something similar, but using Resource Owner Password Credentials Grant so I use user credentiails, not just app-only access, but I can't get file access that way. Is that not supported either? (See: http://stackoverflow.com/q/43885966/177018) – Ergwun May 11 '17 at 01:14

0 Answers0