Search code examples
microsoft-graph-apionedrive

Find Deleted File in an AppFolder


How do I find a file that was deleted and had a relative path of /foo/baz.txt?

I am using the /v1.0 endpoint and my app requests the Files.ReadWrite.AppFolder scope. I can access /drive/special/appRoot.

Will /drive/special/appRoot:/search(q='baz.txt') find deleted files? Will /drive/special/appRoot:/foo/baz.txt:/versionsversions for a deleted file?

There is not a lot of examples (or documentation support) for using AppFolder.


Solution

  • I'm afraid this isn't possible today.

    When a file is deleted from OneDrive (either via the Web App or the API), it is sent to the Recycle Bin and held for 30 days (assuming the user doesn't manually empty it of course).

    At the moment, it isn't possible to access or restore a DriveItem from a dive's Recycle Bin (this has been discussed but I'm unaware of any ETA). The only way to restore an item today is for the user to do so via the OneDrive Web App.