You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected the ScheduledActionsForRule.PostAsync() method, to serialize my deviceComplianceScheduledActionsForRule object, into a JSON property called deviceComplianceScheduledActionForRules, like done inside my browser.
In order to repro this scenario using Intune Portal with the POST call, you just need to edit an existing Compliance Policy, and change any setting in the "Actions for noncompliance" (change for example the value for "Mark device noncompliant" and save your profile). This will trigger a POST call to /beta/deviceManagement/deviceCompliancePolicies/[someID]/scheduleActionsForRules.
Please notice the missing "d" after "schedule" and also the added "s" after "Rule", compared to the SDK or API documentation. This means, no matter what payload you pass to Graph Explorer, if you are using the auto-suggestion "scheduledActionsForRule" in the URL bar or this Graph SDK, it will always make your call to fail...
Expected behavior : harmonize the SDK with the real behavior of GraphAPI.
The text was updated successfully, but these errors were encountered:
Using the SDK you should be able to make the call as
varrequestBody=newMicrosoft.Graph.Beta.DeviceManagement.DeviceCompliancePolicies.Item.ScheduleActionsForRules.ScheduleActionsForRulesPostRequestBody{DeviceComplianceScheduledActionForRules=newList<DeviceComplianceScheduledActionForRule>{newDeviceComplianceScheduledActionForRule{OdataType="#microsoft.graph.deviceComplianceScheduledActionForRule",Id="f0075d5e-5d5e-f007-5e5d-07f05e5d07f0",RuleName="Rule Name value",},},};awaitgraphClient.DeviceManagement.DeviceCompliancePolicies["{deviceCompliancePolicy-id}"].ScheduleActionsForRules.PostAsync(requestBody);
Oooooh my bad again 🫢. I was fooled by GraphExplorer (believing the "/microsoft.graph.scheduleActionsForRules" is sth broken), and by VS autocomplete :
Many traps in this API 😔. Thx so much again for the quick help and example.
I would like to report 2 possible bugs :
First problem is :
When calling graphServiceClient.DeviceManagement.DeviceCompliancePolicies[Id].ScheduledActionsForRule.PostAsync(deviceComplianceScheduledActionsForRule)
the object deviceComplianceScheduledActionsForRule is serialized to sth like :
...as it sticks to this object definition :
Unfortunately, this makes the call to always fail. If you replay the above JSON payload manually with MS GraphExplorer website, you get an error.
When debugging the same action in Intune Portal, the browser sends this JSON payload :
I expected the ScheduledActionsForRule.PostAsync() method, to serialize my deviceComplianceScheduledActionsForRule object, into a JSON property called deviceComplianceScheduledActionForRules, like done inside my browser.
The REST API documentation (https://learn.microsoft.com/en-us/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-create?view=graph-rest-1.0&tabs=http) is not very clear, and the request example omits totally the "scheduledActionConfigurations" block.
The 2nd problem is :
In order to repro this scenario using Intune Portal with the POST call, you just need to edit an existing Compliance Policy, and change any setting in the "Actions for noncompliance" (change for example the value for "Mark device noncompliant" and save your profile). This will trigger a POST call to /beta/deviceManagement/deviceCompliancePolicies/[someID]/scheduleActionsForRules.
Please notice the missing "d" after "schedule" and also the added "s" after "Rule", compared to the SDK or API documentation. This means, no matter what payload you pass to Graph Explorer, if you are using the auto-suggestion "scheduledActionsForRule" in the URL bar or this Graph SDK, it will always make your call to fail...
Expected behavior : harmonize the SDK with the real behavior of GraphAPI.
The text was updated successfully, but these errors were encountered: