question

Tarunkoshy-5122 avatar image
0 Votes"
Tarunkoshy-5122 asked saldana-msft edited

Query on permanently deleted user's Onedrive

Hi,

One of my users has been permanently deleted(user was not restored within 30 days). I had queries regarding the onedrive data of this user

1) For this user, I am able to see their onedrive site using "Get /v1.0/sites" graph api endpoint. The documentation on onedrive data retention indicates that the user's onedrive moves to the recycle bin after it's retention period(30-365 days). I wanted to check if I will still be able to fetch the onedrive site through the API after it moves to the recycle bin or is it limited till the retention period

2)This endpoint "Get /v1.0/sites" fetches all the sites including non onedrive sites. I was wondering is there is a way to fetch only the onedrive sites? When the user was active I could fetch it using "Get v1.0/users/{user-id}/drive" endpoint. Since I cannot fetch the {user-id} anymore, Is there any alternative?


office-sharepoint-onlinemicrosoft-graph-sites-lists
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.

1 Answer

AllenXu-MSFT avatar image
1 Vote"
AllenXu-MSFT answered AllenXu-MSFT commented

Hi @Tarunkoshy-5122,

  • As said in that article, you will no longer be able to access any shared content in the OneDrive after it moves to the recycle bin. So, you will be unable to fetch the OneDrive site through the API after it moves to the recycle bin. However, during retention period, you can still fetch OneDrive site through the API.

  • The $filter operators doesn't include contains as of now in Graph API. It seems to be impossible to filter out only the OneDrive sites. As an alternative, we can use PowerShell to access those sites. Please take a reference to this article: Create a list of all the OneDrive URLs in your organization using Microsoft PowerShell.

    It is correct that we cannot fetch user id any more using API after deleting the user, but we can record the user id in advance. As per my test, we can still use Get
    v1.0/users/{user-id}/drive
    after deleting the user. What you need to do is record his user id ahead of time.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
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.

@AllenXu-MSFT

Thank you for the response. Just a quick question, If I were to restore the OneDrive from the recycle bin, would it be possible to then collect from the API?

0 Votes 0 ·

@Tarunkoshy-5122,

Yes, you can fetch that if restore it from recycle bin.

0 Votes 0 ·