I managed to search within a onedrive folder using the search api (/v1.0/search/query)
with body:
{
"requests": [
{
"entityTypes": ["driveItem"],
"fields": ["id", "name", "file", "folder", "parentReference", "lastModifiedDateTime", "size", "webUrl", "mimeType", "fileType", "metadata", "title", "parentLink", "path", "name"],
"query": {
"queryString": "title:image* AND (parentLink:https://my.sharepoint.com/personal/tony/Documents/test*)"
},
"from": 0,
"size": 100
}
]
}
The issue is that I have another folder name “test (1)”, with the body above, it returns all data from two folders test and test (1), I only want to search all files/folder (nested files/folders too) within “test” folder.
I tried to remove * out of parentLink but results still include files from test (1) folder.
The reason I put * after parentLink is that I want to also search for files in nested folders inside test folder.
What I did to workaround is that I add an extra filter function in my code after receiving data from the request to onedrive, it worked but then I don’t know how to handle pagination the endpoint support.
Any idea how to make it work in this case ? I browsered document from this Graph API Search API but couldn’t find any clue to fix the issue.