Microsoft Graph Search API

Amit Paple 20 Reputation points
2023-09-08T08:52:09.8633333+00:00

I'm using the below endpoint for searching files or folders present in my share point. This end point returns exact match. For Example if the file/folder name is NewCompany then if i pass query as NewCompany then only i will get the response correctly, but my requirement is even if i pass a query as company or new it should match the partially, and give the response. Is their any endpoint or do i need to alter the current end point so to achieve this ?

https://graph.microsoft.com/v1.0/drives/{drive-id}/root/search(q='{search-text}')

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,371 Reputation points
    2023-09-08T10:04:49.4633333+00:00

    Hi @Amit Paple

    You can filter files/folders using the $filter query parameter.

    GET https://graph.microsoft.com/v1.0/drives/{drive id}/root/children?$filter=startswith(name,'xxx')
    

    User's image

    Hope this helps.

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


Your answer

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