microsoftgraph / msgraph-sdk-dotnet

Microsoft Graph Client Library for .NET!
https://graph.microsoft.com
Other
699 stars 247 forks source link

Odering ManagedDevices has no effect #1322

Closed DennisBergemann closed 2 years ago

DennisBergemann commented 2 years ago

HI,

i try to get ordered managedevices but, all ordering will be ignored.

`var queryOptions = new List { new QueryOption("$top",$"50"), }; var orderBy = "deviceName";

        var managedDevices = await _graphServiceClient.DeviceManagement.ManagedDevices
                                             .Request(queryOptions)
                                             .Header("ConsistencyLevel", "eventual")
                                             .OrderBy(orderBy)
                                             .Select("deviceName")
                                             .GetAsync();`

code above is an example.

Am I doing something wrong? Is there another way for the intune queries?

thanks a lot

MIchaelMainer commented 2 years ago

I don't think you're doing anything wrong. I suspect that the endpoint doesn't support service-side ordering as I don't see an example in the documentation. Your experience would also confirm that.

https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-list?view=graph-rest-1.0

The client libraries are generated which results in some operations being generated for service-side functionality that doesn't exist.

You'll want to perform the ordering client-side.

DennisBergemann commented 2 years ago

Ok but i think you're wrong, original intune (endpointmanager) supports ordering with same graphapi endpoint. You can test it by your self by pressing the order button and activate the developer console in your browser before

Additionaly this documentation states query parameters are supported: https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-get?view=graph-rest-1.0#optional-query-parameters

@andrueastman Can you check or tell me why there is this difference?

Thank you