Question

I want to get all private folders(and files) for all users in one drive for business using REST API.

I got access token for https://mydomain-my.sharepoint.com using administrator account.

Now I am trying to get all private folders for all users using the below URL

https://mydomain-my.sharepoint.com/personal/user_domain_onmicrosoft_com/_api/files

I am able to get the list of files to the user whose credentials I used to get the access token.

But when I tried for any other user, I get only the files the user has shared.

How to get all the private folders of an user using REST API?

Any help would be appreciated

Was it helpful?

Solution

This can only be possible after the Admin is added to the Site Collection Owner group for other users. Once that is done, you can access their data. But keep in mind that this is a very lengthy activity.

Refer to this link to achieve it >>> http://blogs.technet.com/b/educloud/archive/2013/05/15/administrator-access-to-skydrive-pro.aspx

OTHER TIPS

In Azure AD add all the permissions that you can off SharePoint.

Use this endpoint for list all the folders:

https://mydomain-my.sharepoint.com/personal/user_domain_onmicrosoft_com/_api/v1.0/files/{folder_id}/children

folder_id = root, for the Root folder

This worked for me.

also you can get the list of all the sharepoint sites using this query:

https://{tenant}.sharepoint.com/_api/search/query?querytext='contentclass:sts_site+contentclass:sts_web'

I've done this by configuring an application in Azure that uses the SharePoint online API with full control of tenant application permissions. You need to get an app-only token using the client-credential oath flow. This way we can elevate privileges to full control thus enabling us to get private folders/files.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top