Share via

Graph Sharepoint API Search - does not return expected results

Andreas Davros 101 Reputation points
2022-08-08T07:42:08.217+00:00

I have a deeply nested folder inside a sharepoint drive. I try to find it using the following request (graph explorer):

https://graph.microsoft.com/v1.0/groups/{group_id}/drives/{drive_id}/root/search(q='searchTerm')

The folder is named: 12 Word 12345

If searchTerm = 12 i get the folder. Same result if i search with Word or 12345

However, if I search for ord or 234 i do not get any results.

Same behavior is observed with files.

Is this behavior expected..?

If so, any directions on how I can search for part of a word/file or folder name by providing a substring of the name..?

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph

Answer accepted by question author

RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
2022-08-09T02:03:45.173+00:00

Hi @Andreas Davros ,
Per my test, I can reproduce this scenario too. If you want to get the file by search, you need to set the search term the whole word in the file name such as '12', 'Word', and '12345'. Substring of them such as 'rd', '234' won't match the result. You can also set metadata and file content as searchTerm value. Here is the document for more details
https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http


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.


Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Shivam Dhiman 6,086 Reputation points
    2022-08-08T16:18:17.617+00:00

    Hi @Andreas Davros

    I am able to reproduce this scenario and it seems to be expected behavior.

    If the answer is helpful, please click "Accept Answer" and kindly upvote. If you have further questions about this answer, please click "Comment".

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.