Harald S.
Harald S.

Reputation: 13

Microsoft Graph API SharePoint Files Search

I try to search for files on SharePoint Document Library (e.g. the default 'root'). I created a few test-files by uploading them or create new Office files online and made some search-requests, e.g. https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='{query}') and until yesterday everything worked fine.

Now I started to edit files on SharePoint or created/uploaded new ones and with this edited or new files, I have the problem that I get no result when I search for them. "old" files, I created when I started I find although, as long as I don't edit them.

To get access I registered an App inside the AAD and gave it the needed permissions (

Sites.Read.All, Sites.ReadWrite.All, Files.Read.All, Files.ReadWrite.All

and a direct access to a specific file with https://graph.microsoft.com/v1.0/sites/root/drive/items/{item-id}/ works also well.

Upvotes: 1

Views: 2937

Answers (1)

Seiya Su
Seiya Su

Reputation: 1874

Search will read data from indexed data, but crawling and re-indexing of a library need to take some time. So you the code return null for the new files:

https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='{query}')

The following code get the library data directly but not based on the indexed data, so it works well.

https://graph.microsoft.com/v1.0/sites/root/drive/items/{item-id}/

Upvotes: 1

Related Questions