msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

Some Properties for Device not implemented

Open DennisBergemann opened this issue 3 years ago • 6 comments

Hi,

on Datatype Device some properties are missing. GraphApi has "manufacturer" as example, but your Datatype Device is implemented without it.

Maybe iam wrong and you provide it with overloads and i need an using statement?

Can you give me advice accessing properties like manufakturer with your sdk? From Graphapi they are available and documented for Device.

Thanks a lot

DennisBergemann avatar Jul 07 '22 18:07 DennisBergemann

Hello @DennisBergemann can you provide a link to the documentation where you found "manufacturer"?

MIchaelMainer avatar Jul 07 '22 19:07 MIchaelMainer

Hello @MIchaelMainer ,

sure no problem.

here: https://docs.microsoft.com/en-us/graph/api/resources/device?view=graph-rest-1.0

you can see some properties like manufacturer, which not available on object Device in sdk.

NOTE Properties on linked page (scroll down)

thank you

DennisBergemann avatar Jul 08 '22 07:07 DennisBergemann

@DougKirschner and/or @SanDeo-MSFT, it looks like the v1 documentation and the v1 metadata are not in sync for the Device type. Can you clarify whether the documentation or metadata is correct?

MIchaelMainer avatar Jul 13 '22 21:07 MIchaelMainer

@MIchaelMainer For me its clear. I can get the data with direct connecting to graph, with Powershell or GraphExplorer. So it can't be documentation. Or i understood wrong?

Did you have created the classes from metadata?

Funfact is when i write your "device" class as json its is with all the proprerties (you formatter does right). Only when i try to access in c# its not accessible, because its not implemented in device.

Hope it helps

DennisBergemann avatar Jul 14 '22 07:07 DennisBergemann

We generate the classes from the metadata defined at https://graph.microsoft.com/v1.0/$metadata. Which looks to be inconsistent with the documentation.

If the properties are being returned from the API, you should be also be able to access them from the additionalData property while this inconsistency is resolved. This should work for other models where the API returns properties not defined in the model class as well.

var device = await graphClient.Devices["{device-id}"]
    .Request()
    .GetAsync();

string manufacturer = device.AdditionalData["manufacturer"].ToString();

andrueastman avatar Jul 14 '22 07:07 andrueastman

@andrueastman yes i will give it try, thanks for giving an work around.

And for you all i have to say, i love your project so much. Thank you

DennisBergemann avatar Jul 14 '22 10:07 DennisBergemann

Closing for now as property is available in latest SDK versions. https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/fea8c900edf63a27e9c76d81e8f17b3b20db1b95/src/Microsoft.Graph/Generated/Models/Device.cs#L194

andrueastman avatar Apr 03 '24 13:04 andrueastman