-1

I use the MS Graph API to upload data to OneDrive. I have deleted all data on OneDrive, but when I use the :

 var search = await graphClient.Users[user.Id].Drive.Root
                    .Search("")
                    .Request()
                    .GetAsync();

                foreach (var item in search)
                {
                    Console.WriteLine(item.Name);
                }

I get data displayed even though my OneDrive is empty, why ?

I use: .Net 4.7.2, Visual Studio

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
BigShady
  • 33
  • 8
  • I have used the Graph Explorer to display all data => https://developer.microsoft.com/en-us/graph/graph-explorer The data is displayed although my OneDrive is empty. – BigShady May 06 '20 at 09:51
  • I'm afraid there isn't enough information to go on. It isn't clear if this is OneDrive or OneDrive for Business, how the items were deleted, if all of the deleted files were still showing up, or how long after deleted files were still getting returned. – Marc LaFleur May 06 '20 at 11:57
  • I use OneDrive for Business. I have deleted the items from the Explorer. Now I have deleted all data on my OneDrive, but if I use the API all data on OneDrive is still showing me data that should not be there anymore. I emptied the recycle bin, and My Documents. When I search for a file that the Graph API shows me in OneDrive, I see it too, in the column "modified by" it says "SharePoint App". But I cannot retrieve the file itself, the following error message appears: "This item may not exist or may no longer be available." – BigShady May 06 '20 at 12:31

1 Answers1

0

The solution is:

If I use this code:

     var search = await graphClient.Users[user.Id].Drive.Root
                    .Search("")
                    .Request()
                    .GetAsync();

He's searching through the index. Data can also be displayed there although it is no longer available.

Therefore, data that is no longer available on OneDrive is also displayed.

Do not use the search function.

BigShady
  • 33
  • 8