question

LapSangOscarYiu-0060 avatar image
0 Votes"
LapSangOscarYiu-0060 asked saldana-msft edited

How to access all company staff onedrive, and remove the folder inside it everyday?

I am reading graph-explorer below. https://developer.microsoft.com/en-us/graph/graph-explorer

However, I don't know which api can access all staff one drive.

microsoft-graph-filesmicrosoft-graph-explorer
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

When you say all staff OneDrive, do you mean all files in a users one drive or one drives for all users in the tenant?

0 Votes 0 ·

1 Answer

Danstan-MSFT avatar image
0 Votes"
Danstan-MSFT answered

You can start with MS Graph Files API which allows you to list the files and delete them. The files APIs give you access to the one drive as per the permissions granted by the signed in user.

Note that on Graph Explorer you can only do this for the current signed in user. To do this for all users in our tenant which is what I understand you mean by all staff, you need to use application permissions. Checkout Quickstart: Get a token and call the Microsoft Graph API by using a console app's identity.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.