microsoftgraph / msgraph-beta-sdk-dotnet

The Microsoft Graph Client Beta Library for .NET supports the Microsoft Graph /beta endpoint. (preview)
Other
95 stars 32 forks source link

BitLockerRecoveryKey VolumeType Conversion from https request wrong #848

Open kronsteinerPT opened 4 months ago

kronsteinerPT commented 4 months ago

Describe the bug

Im trying to get all BitlockerRecoveryKey objects via Graph API using the GraphServiceClient library in the newest beta version 5.77.0-preview. This is my request: var allBitlockerRecoveryKeys = await GraphClient.InformationProtection.Bitlocker.RecoveryKeys.GetAsync(requestConfiguration => { requestConfiguration.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"); });

This is one of the results: image

The Volume Type is "FixedDataVolume" in every Result which is strange in itself but ok. But if I now look at the same deviceId in Azure via my browser, the Volume Type is "Operating system drive". image

Also if i go through the http data that my own GraphClient gets i get the Volume Type "1" (which stands for Operating System Drive according to the docu)

But somehow if it goes through the type from Microsoft.Graph.Beta.Models it gets converted to the wrong type.

Expected behavior

The VolumeType should convert the json data from the http request result to the correct value. volumeType=1 => operatingSystemVolume volumeType=2 => fixedDataVolume ...

How to reproduce

NuGet Package Microsoft.Graph.Beta 5.77.0-preview Functioning and Authenticated GraphClient Execute var allBitlockerRecoveryKeys = await GraphClient.InformationProtection.Bitlocker.RecoveryKeys.GetAsync(requestConfiguration => { requestConfiguration.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"); });

SDK Version

5.77.0-preview

Latest version known to work for scenario above?

No response

Known Workarounds

Workaround is to just use a normal http request without GraphServiceClient Library

Debug output

Click to expand log ``` ```

Configuration

Windows 11, x64 Nothing Special. Using Visual Studio 22 net6.0

Other information

No response

andrueastman commented 4 months ago

Thanks for raising this @kronsteinerPT

Are you by any chance able to make the same the request using the Graph Explorer and view the json response value? It would be helpful to identify from the json response if the value returned by the API is correct to narrow this down to a deserialization error.

kronsteinerPT commented 3 months ago

Yes the Json from the API is correct. I get VolumeType : "1" as a response from every device image

microsoft-github-policy-service[bot] commented 3 months ago
andrueastman commented 3 months ago

The generated SDK has the member names as the string representations while the API is returning number values. https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet/blob/7b3e51132513d59a44bffd726459f9c609fd6427/src/Microsoft.Graph/Generated/Models/VolumeType.cs#L10

We'll need to follow this up with the metadata to get a picture of what the expecatation is here.