search inside a folder returns no results in onedrive.

RobertV 41 Reputation points
2022-03-25T09:27:29.443+00:00

I'm adding a file search function to my code. Search works fine on root level. But searching inside a folder gives no results.

https://graph.microsoft.com/v1.0/drives/*onedrive id*/items/root id/search(q='testseach')

Returns a 200 with the file data.

https://graph.microsoft.com/v1.0/drives/*onedrive id*/items/folder id/search(q='testseach') *

Folder id is a driveitem containing the file im looking for.
Returns a 200 and an empty list.

I have tried this search on a Teams drive. There It works as intended and I do get results back on a search inside other folders.

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

Accepted answer
  1. Shivam Dhiman 5,951 Reputation points
    2022-03-25T11:11:31.847+00:00

    Hi @RobertV

    I am not able to replicate your issue its giving me desired output. As you can see I am able to retrieve file present inside Testing Folder in my OneDrive.
    186890-onedrive.png

    Result

    186850-result1.png

    Further you can refer to these similar posts-
    Graph Drive Search - does not return all file types
    Graph API Search for DriveItems within a drive

    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".


0 additional answers

Sort by: Most helpful