To get the Compliance Policy Settings in Intune, we need to use the below api (reference):
Request URL: https://graph.microsoft.com/beta/deviceManagement/settings
Request Method: GET
I can run the api and get the details using Postman, however im struggling to get the API running using Microsoft Graph (Beta) in Java.
Example : Im using the below code snipped for fetching all the compliance policies using microsoft graph beta api:
List<DeviceCompliancePolicy> allDeviceCompliancePolicies = new ArrayList<DeviceCompliancePolicy>();
DeviceCompliancePolicyCollectionPage deviceCompliancePolicyCollectionPage = this.graphClient
.getGraphServiceClient().deviceManagement().deviceCompliancePolicies().buildRequest()
.expand("assignments,scheduledActionsForRule($expand=scheduledActionConfigurations)").get();
while (deviceCompliancePolicyCollectionPage != null) {
final List<DeviceCompliancePolicy> deviceCompliancePolicies = deviceCompliancePolicyCollectionPage
.getCurrentPage();
allDeviceCompliancePolicies.addAll(deviceCompliancePolicies);
final DeviceCompliancePolicyCollectionRequestBuilder nextPage = deviceCompliancePolicyCollectionPage
.getNextPage();
if (nextPage == null) {
break;
} else {
deviceCompliancePolicyCollectionPage = nextPage.buildRequest().get();
}
}
From the javadoc its clear the settings are seen in DeviceManagementSettings class, however im unable to get an instance of that class using graph api.
Any help to resolve the above is greatly appreciated!