13

This code works

https://graph.microsoft.com:443/v1.0/me/drive/root?$filter=Size eq 0&$expand=children($select=id,folder,name,parentReference,cwebUrl)&$select=Id,folder,name,parentReference,children,webUrl

I want to filter inside the children:

https://graph.microsoft.com:443/v1.0/me/drive/root?$filter=Size eq 0&$expand=children($select=id,folder,name,parentReference,cwebUrl&$filter=Size eq 0)&$select=Id,folder,name,parentReference,children,webUrl
XzaR
  • 610
  • 1
  • 7
  • 17

1 Answers1

13

When filtering/selecting within an expand, you need to use ; as the separator, not &. So your URL should be:

https://graph.microsoft.com:443/v1.0/me/drive/root?$filter=Size eq 0&$expand=children($select=id,folder,name,parentReference,cwebUrl;$filter=Size eq 0)&$select=Id,folder,name,parentReference,children,webUrl

Here is an example of a URL on the TripPin example OData service to show this in action:

http://services.odata.org/V4/TripPinServiceRW/People?$expand=Trips($select=TripId,Name,Description;$filter=TripId eq 0)

TomDoesCode
  • 3,580
  • 2
  • 18
  • 34
  • 1
    Does not work for Microsoft Graph... for example: `https://graph.microsoft.com/v1.0/users?$expand=memberOf($select=id,displayName;$filter=displayName eq 'Legal')&$select=Id,memberOf` is not able to filter the "Legal" groups or users that only contain it. – BBacon Oct 03 '22 at 23:49