Jan 23 2019 06:45 AM
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,
Feb 08 2019 06:59 AM
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
Mar 12 2019 06:19 PM
SolutionIn 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 URL: https://graph.microsoft.com/beta/deviceManagement/managedDevices('22222222-2222-2222-2222-2222222222...
Request Method: PUT
Request Payload: {@odata.id: "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/11111111-1111-1111-1111-111111111..."}
Sample response: 204
Mar 17 2019 10:00 PM
Mar 17 2019 10:01 PM
Mar 12 2019 06:19 PM
SolutionIn 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 URL: https://graph.microsoft.com/beta/deviceManagement/managedDevices('22222222-2222-2222-2222-2222222222...
Request Method: PUT
Request Payload: {@odata.id: "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/11111111-1111-1111-1111-111111111..."}
Sample response: 204