Get details of all the deleted files from a SharePoint site using MS Graph API

VIPPALA MADHAVA REDDY 50 Reputation points
2024-01-18T15:49:14.3833333+00:00

I need to get the details of files that are deleted permanently or moved recycle bin in a given SharePoint site. I have tried the driveItem: delta query, but it was giving files that were modified a longtime back also even I follow guidelines mentioned here - driveItem: delta. Also, it does not give any details about the file itself such as name and path of the file. But I only need to get the files that were deleted on or after a specific date.

I have tried this List recycle bin Items but this is giving me an empty list in the response.

I am currently getting recently modified files by using Get list items using a date filter, but this is not giving deleted files in the response.

Is there a way to get details of files that were deleted using MS Graph API ?

References:

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

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,476 Reputation points Microsoft External Staff
    2024-01-19T02:54:19.7+00:00

    Hi @VIPPALA MADHAVA REDDY,

    Currently we can only get deleted items by the two graph api you mentioned. For listing deleted files/folders, you can use delta query as it enables applications to discover newly created, updated, or deleted driveItems. But the api is unable to get the details of the deleted items. And there are no filters available to filter deleted files.

    For Recycle bin, items are retained for 93 days from the time you delete them from their original location. You could refer to following document.

    https://support.microsoft.com/en-us/office/restore-deleted-items-from-the-site-collection-recycle-bin-5fa924ee-16d7-487b-9a0a-021b9062d14b#:~:text=How%20long%20are%20deleted%20items,or%20empties%20that%20Recycle%20Bin.

    Currently there is no such api for us to get the details of the deleted files. I suggest you submit a user voice to add a support request for accessing deleted items by graph.

    ---If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 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.


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.