Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph API SharePoint search

I have been trying to search through my SharePoint site. I am able to get results for a single drive:

xxx.sharepoint.com,xxxxxx-xxxx-xxxx-xxxx-xxxxxx,xxxxx-xxxx-xxxx-xxxx-xxxxxx/drives/xxxxxxxxx/search(q='{content}')

But if I do the same search at drive/root, I don't get any result:

xxx.sharepoint.com,xxxxxx-xxxx-xxxx-xxxx-xxxxxx,xxxxx-xxxx-xxxx-xxxx-xxxxxx/drive/root/search(q='{content}')

We basically want to perform a search across the entire subsite.

like image 833
kenrickvaz Avatar asked Nov 07 '22 13:11

kenrickvaz


1 Answers

Hey a bit late but I've just discovered you can use the /sites endpoint to retrieve all items in a site by expanding relationships of graph objects. Could you try use:

https://graph.microsoft.com/v1.0/sites/root/sites?$expand=lists($expand=items)

This seems to return all list items in all subsites under the root site. You should hopefully then be able to to filter further by subsite, list, field values etc.

like image 132
zyme Avatar answered Nov 15 '22 05:11

zyme