Forum Discussion
Nayuta
Jan 23, 2019Copper Contributor
Update Intune Managed Device Category with Microsoft Graph were Failed
I'd failed to update the managed device category in Intune with Microsoft Graph. With the same code, I'd succeeded to update device owner. Parameter below:
URL: https://graph.microsoft.com/beta/deviceManagement/managedDevices('XXXXXXXXXX')
Method: PUT
Failed request body:
{ "deviceCategoryDisplayName": "General Purpose" }
Succeeded request body:
{ "Owner": "Personal" }
"General Purpose" is a custom value. When failed, the server returns an error code and activity id.
How can I fix it?
Thank you.
Regards,
In addition to what Oliver said, here's how if you want to do it through Graph API:
1. Create the category
Request URL : https://graph.microsoft.com/beta/deviceManagement/deviceCategories
Request Method: POST
Request Payload: {displayName: "testCategory(displayNameOfCategory)"}
Sample response:
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceCategories/$entity",
"id":"11111111-1111-1111-1111-111111111111(TakeThisIDItIsYourDeviceCategoryID)",
"displayName":"testCategory",
"description":null
}
Or Get categories if created already
Request URL : https://graph.microsoft.com/beta/deviceManagement/deviceCategories
Request Method: GET
Sample response:
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceCategories",
"value":[{"id":"11111111-1111-1111-1111-111111111111","displayName":"testCategory","description":null}]
}
2. Set the category for device
Request Method: PUT
Request Payload: {@odata.id: "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/11111111-1111-1111-1111-111111111111(DeviceCategoryId)"}
Sample response: 204
4 Replies
Sort By
- wazha
Microsoft
In addition to what Oliver said, here's how if you want to do it through Graph API:
1. Create the category
Request URL : https://graph.microsoft.com/beta/deviceManagement/deviceCategories
Request Method: POST
Request Payload: {displayName: "testCategory(displayNameOfCategory)"}
Sample response:
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceCategories/$entity",
"id":"11111111-1111-1111-1111-111111111111(TakeThisIDItIsYourDeviceCategoryID)",
"displayName":"testCategory",
"description":null
}
Or Get categories if created already
Request URL : https://graph.microsoft.com/beta/deviceManagement/deviceCategories
Request Method: GET
Sample response:
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceCategories",
"value":[{"id":"11111111-1111-1111-1111-111111111111","displayName":"testCategory","description":null}]
}
2. Set the category for device
Request Method: PUT
Request Payload: {@odata.id: "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/11111111-1111-1111-1111-111111111111(DeviceCategoryId)"}
Sample response: 204
- NayutaCopper Contributor
Hi,
you have to create the category first in Intune before you can assign it to a device:
otherwise you are not seeing it and assignment is not allowed:
I think this constrained is the same when doing it via graph.best,
Oliver- NayutaCopper ContributorThank you. But, I want to update with Microsoft Graph API (: