microsoftgraph / msgraph-sdk-go

Microsoft Graph SDK for Go
https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
MIT License
235 stars 36 forks source link

MangedDevice serialize loses most of the data #692

Open CmckeeverNova opened 5 months ago

CmckeeverNova commented 5 months ago

When I get the list of maganed devices using the sdk i can see all the info there and once I serialize it using the built in function it loses most of the data, seemingly cutting off everytime at: "partnerReportedThreatState":"unknown"

This is how it is being serialized: case *models.ManagedDevice: err = graphModel.Serialize(writer) if err != nil { return }

Using: result, err := client.DeviceManagement().ManagedDevices().Get(ctx.Context, nil)

and doing a page iterator for each device: pageIterator, err := msgraphcore.NewPageIterator[*models.ManagedDevice](result, client.GetAdapter(), models.CreateManagedDeviceCollectionResponseFromDiscriminatorValue) if err != nil { return } err = pageIterator.Iterate(ctx.Context, func(device *models.ManagedDevice) bool {

CmckeeverNova commented 5 months ago

From investigating it further it seems that the serialisation for ManagedDevice and AuditEvent in device managament isnt completed to include all the fields

rkodev commented 5 months ago

@CmckeeverNova would you mind sharing the version of the sdk you are using and some of the missing fields. In the meantime you should be able to access the fields in field 'device.GetAdditionalData()'

CmckeeverNova commented 5 months ago

Im using v1.39.0

The only fields I get from any ManagedDevice are: id, complianceState, deviceEnrollmentType, deviceRegistrationState, exchangeAccessState, exchangeAccessStateReason, managedDeviceName, managedDeviceOwnerType, managementAgent, partnerReportedThreatState.

Every other field is missing from the result of Serialize()

rkodev commented 5 months ago

@CmckeeverNova Are you able to access the fields using device.GetAdditionalData()

CmckeeverNova commented 5 months ago

@rkodev GetAdditionalData returns nothing back

CmckeeverNova commented 3 months ago

Are there any updates to this or changes made recently?

kwapik commented 2 months ago

I just bumped into this issue in the newest version i.e. v.1.46.0. I hope it can be resolved soon. For now, this is the only resource I found to have this error.

rkodev commented 2 months ago

@kwapik could you Graph Explorer to execute the same get command and share the response you receive.

kwapik commented 1 month ago

@rkodev sorry for the late reply, I just missed your comment.

Actually, I don't have any tenant with real data to test on. I did test this on a HTTP server which fakes EntraID API responses and I only had issues with Managed Devices.