Closed AndrewShchetkin closed 5 months ago
Transferring this to the beta repo as this related to the beta SDK.
Thanks for raising this @AndrewShchetkin
Any chance you can confirm if the policy
object is received from another API response. This may be related to the working of the backingStore.
https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/upgrade-to-v5.md#backing-store
Thanks for the quick answer @andrueastman Yes, I guess it's related. Actualy I deserialize object from json and then set some default fields as null or so on.
Do you have any idea how can I send all object properties instead of recreate instance?
@AndrewShchetkin
Any chance it works out for you if you reset the backingStore store state as below before sending out the data?
policy.BackingStore.InitializationCompleted = false;
@andrueastman Yeah, it makes serialization better but not enough. In this case I'm sendong entity with null fields, but API doesn't expect it. For example if I pass createdDateTime
property as null
API throw an error
"A null value was found for the property named 'createdDateTime', which has the expected type 'Edm.DateTimeOffset[Nullable=False]'"
So, I don't see any other variant as recreate entity directly before the post request. Of course serialize and deserialize works in the same way.
I guess we can close the issue, again @andrueastman thank you for help
Trying to create Intune
DeviceCompliancePolicy
by Graph SDK and getting a error "Cannot create an abstract class". I started looking on request by Fiddler and found that my request has json with empty props OR just with braces"{}". Code example:Anyway, now I serialize body manualy and it works as expected
My implementation for serialize objects:
Expected behavior I believe body should be serialized correct.
Client version Microsoft.Graph.Core - 3.1.3 Microsoft.Graph.Beta - 5.60.0
Additional context Here is Batch request with 2 requests, first one is prepared manualy and second by method
ToPostRequestInformation
. NOTE it's the same object