Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Items GetAsync with Filter on Name, expect 1 result but get 0 #2700

Open
AcidRaZor opened this issue Oct 7, 2024 · 2 comments
Open

Items GetAsync with Filter on Name, expect 1 result but get 0 #2700

AcidRaZor opened this issue Oct 7, 2024 · 2 comments

Comments

@AcidRaZor
Copy link

I've found that using filter on a folder (in this case my root / Shared Documents in SharePoint) it doesn't return the folder


var folderSearch = await serviceClient!
            .Drives[drive.Id]
            .Items
            .GetAsync(cfg => cfg.QueryParameters.Filter = "name eq 'myfolderthatexists'");

Since my folder has 200+ items in it, I used PageIterator (since I saw ONextDataLink being returned) and saw I had to page to the item before it returns?

The expectation of Filter (at least in my opinion) should return that driveitem only

I don't mind using PageIterator, as soon as I detect the Item I just return false to stop it. I'm just wondering why the filter returns empty pages until it's on the page it expects?

@AcidRaZor AcidRaZor added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Oct 7, 2024
@andrueastman
Copy link
Member

Thanks for raising this @AcidRaZor

Are you by any chance able to replicate this on the Graph Explorer? This sounds like an issue with the API returning empty responses for some of the pages.

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 7, 2024
@AcidRaZor
Copy link
Author

AcidRaZor commented Oct 7, 2024

@andrueastman Thanks for the reply, and yes I can (I tried both to make sure I wasn't going insane)

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('snip')/items",
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/drives/snip/items?$filter=name+eq+%27shitzandgigs%27&$skiptoken=snip",
    "@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET drives('<key>')/items?$select=audio,bundle",
    "value": []
}

It returns the odata.nextLink, and as I keep paging, it only returns data for the filtered item on the page it thinks it is on as if I'm querying the data without a filter.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants