Search files with given file name substring in OneDrive

Dhruvin Moradiya 55 Reputation points

I want to search for files in a specific folder based on the given file name (it can be a substring of the file name).
/me/drive/search(q='Contoso Project') Endpoint searches this q parameter across several fields. I want that it to search for file names only.

If five files have 'test' as a substring in their name, then /me/drive/search(q='test') API should return five files only. Right now, it's returning mode then five files (comparing substring 'test' with multiple fields).

Any Idea how to limit search queries to file names only?

Also, /me/drive/search(q='Contoso Project') endpoint doesn't return all types of files. I want all types (mimeTypes) files in search results.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,452 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous

    Hello Dhruvin Moradiya,

    Thanks for reaching out!

    To get files in a specific folder based on the given file name please refer to the documentation. Including ParentLink:/FolderName, along with Path should be able to retrieve files and images as well from a parent folder.

    "requests": [  
            "entityTypes": [  
            "query": {  
                "queryString": "searchstring AND Path: Documents AND ParentLink:/FolderName"  

    Please refer to the similar post:

    Hope this helps.

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