What we want is get a list of files with specified extension in a given folder or its sub folders.
And the search API is used in pattern
https://graph.microsoft.com/v1.0/me/$drive$/items/$itemid$/search(q='$ext$')?$filter=endsWith(name, '$ext$')
Where
$drive$ can be drive (for ones own) or drives/%driveId% (for shared item)
$itemid$ is the drive item id of the given folder
$ext$ is file extension such as xlsx
But for different account (personal, business) / share folder we get kinds of different unexpected results as following:
- 501 (error code: notSupported, filter related) (business account)
If remove the $filter, it works with 200 success response code. But the filter works for personal account:
- Search is not always work for shared folder, some works but others not (no match), even they all shared by same account. Search with no matched items for bundle shared. (a personal to personal share) The following picture gives three shared folders from same person:
You can see they has same value for parentReference.driveId. The 1st one is a bundle.
Search works for the last one (id: 9F06E2BEF31BA398!110) but no match for other two:
Worked item (https://graph.microsoft.com/v1.0/me/drives/9f06e2bef31ba398/items/9f06e2bef31ba398!110/search(q='xlsx')?$filter=endsWith(name, 'xlsx')):
No matched items:
- Normal
Replace search(...) with children, you can find there has matched files:
- Bundle
Replace search(...) with children, you can find there has matched files:
So we want to know is any limitation about the usage, or another way / API can help to ensure we get the expected result.
Thanks in advance,
Henry