2
votes

I need to access all users' files in a domain via REST API. I could only access the domain user's files via access token granted via normal OAUTH flow.

I found this article: Building Daemon or Service Apps with Office 365 Mail, Calendar, and Contacts APIs (OAuth2 client credential flow)

This article mentions only Mail, Calendar, and Contacts API. Is File API supported?

1

1 Answers

0
votes

This is what worked for me:

  1. Create an access_token as described here https://graph.microsoft.io/en-us/docs/authorization/app_only and use it in the next steps in the Authorization header
  2. Get all the users using this REST API: https://graph.microsoft.com/v1.0/users
  3. Iterate through the users and get their files with this API (adding their userPrincipalName in the url): https://graph.microsoft.com/v1.0/users/[email protected]/drive/root/children