Query on permanently deleted user's Onedrive

Tarun koshy 131 Reputation points
2021-04-05T13:26:27.877+00:00

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?

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Allen Xu_MSFT 13,866 Reputation points
    2021-04-06T09:28:47.367+00:00

    Hi @Tarun koshy ,

    • 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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.