Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I filter and select inside a expanded collection on Microsoft Graph?

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
like image 572
XzaR Avatar asked Jul 07 '17 10:07

XzaR


People also ask

How can multiple requests be executed in a batch request?

Individual requests can be executed in a specified order by using the dependsOn property. This property is an array of strings that references the id of a different individual request.

Which of the following statements is true about the batch request support in Microsoft Graph?

Which of the following statements is true about the batch request support in Microsoft Graph? Batching reduces the number of round trips an application makes to Microsoft Graph by submitting multiple requests in one HTTP round trip.


1 Answers

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)

like image 162
TomDoesCode Avatar answered Sep 28 '22 18:09

TomDoesCode