Support for Assigning User Licenses in Microsoft Graph API? - microsoft-graph-api

When will support for assigning user licenses in O365 be added for the Microsoft Graph API? Currently in version 1.0, I get the following error when trying to assign a license,
{
"error": {
"code": "Request_BadRequest",
"message": "Property 'assignedLicenses' is read-only and cannot be set.",
"innerError": {
"request-id": "0827887a-4e46-48d6-93c6-81825aeaac61",
"date": "2017-06-16T18:35:29"
}
}
}
Will this be supported in version 2.0? If so, is there a timeframe it will be added?

Assigning licenses is supported, but not through updating the property. This property is indeed read only. We should improve our error message here to indicate how this can be set - sorry about that.
What you need to do is use the assignLicense method. The info is here: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_assignlicense. Please let me know if you have any further challenges using this method.
Hope this helps,

Related

preferredDataLocation field in microsoft graph API not working in v1.0

I am working on a feature where I need to find preferredDataLocation field for all the users but it turns out that it is currently in beta version. How can we check estimated date of this feature going into stable version? I tried to check on Microsoft 365 Roadmap but couldn't find it. I tried to use following request
https://graph.microsoft.com/v1.0/users/delta$select=id,preferredDataLocation
but it gives the following error
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Invalid property: preferredDataLocation",
"innerError": {
"request-id": "c93a43cb-fa9d-4803-801a-5864439ad66d",
"date": "2020-06-02T09:24:30"
}
}
}
If I use request without delta then it works fine. Example
https://graph.microsoft.com/v1.0/users$select=id,preferredDataLocation
After checking in the metadata the property is not available in v1.0 for users today (only groups). Hence why it fails when requested for delta query. I created a documentation issue to get the documentation fixed.
You can perform the same query using the beta endpoint today as a workaround.

Microsoftgraph Which Ids to remove license?

I would like to remove a license from a user using the microsoft graph API. I am currently using graph explorer to experiment with this.
I have not found much information here regarding microsoftgraph. I find the microsoft documentation and examples unclear on this point.
Here is the data I have to work with. graph explorer snip_one I have tried option A)
When I post to the assignLicense endpoint, I get this error message, and I find little information via google/SO about this. graph explorer snip_two Specifically, I find little about
"Cannot convert a primitive value to the expected type 'Edm.Guid'"
{
"error": {
"code": "Request_BadRequest",
"message": "Cannot convert a primitive value to the expected type 'Edm.Guid'. See the inner exception for more details.",
"innerError": {
"request-id": "7e63fcf2-8fce-4a5c-9f40-3348fba1fb13",
"date": "2019-12-05T01:37:14"
}
} }
OK, with more experimentation, the skuID was what was needed in the removedLicenses list
It's the GUID here: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference
Note there's a link to the latest version in CSV file format.

List events API call on Microsoft Graph Java SDK doesn't work for #outlook.com domain

When I tried the following GET request using Microsoft Graph explorer:
https://graph.microsoft.com/beta//me/calendars/joseph.baker.doodle#outlook.com/calendarView?startDateTime=2019-10-24T07:40:43.133Z
I got this response:
{
"error": {
"code": "ErrorInvalidIdMalformed",
"message": "Id is malformed.",
"innerError": {
"request-id": "7ffa9b3c-b5bf-4171-b5ad-242dd831b629",
"date": "2019-11-21T06:30:12"
}
}
}
When I try it with user's calendar ID:
https://graph.microsoft.com/beta//me/calendars/AQMkADAwATM3ZmYAZS0yNDI1LTEwMmMtMDACLTAwCgBGAAADWt9re56XX0ay-rq-yg7yKwcA94f8IFhbyEuRrCHknQvqSwAAAgEGAAAA94f8IFhbyEuRrCHknQvqSwAAADW523EAAAA=/calendarView?startDateTime=2019-10-24T07:40:43.133Z&endDateTime=2019-10-31T07:40:43.133Z
Also for an account with #onmicrosoft.com:
https://graph.microsoft.com/beta//me/calendars/joseph.baker.doodle#onmicrosoft.com/calendarView?startDateTime=2019-10-24T07:40:43.133Z
It works as expected.
Can somebody help me with this? Is the issue domain-related?
Calendars are always referenced by id instead of name. Also, since Outlook.com is a single-user platform, it simply isn't possible to reference another user's resources.
I'm frankly surprised /me/calendars/joseph.baker.doodle#onmicrosoft.com/ since this is not a supported/documented address scheme.

Micorsoft Graph API Responsibilites Update

I am attempting to update the responsibilities field on a user account through the Graph API.
I am attempting to do this using the following request:
PATCH https://graph.microsoft.com/v1.0/users/<upn>
{
"responsibilities":[
"ApprovalLimit:0"
]
}
When i make this request, I get the response:
{
"error": {
"code": "-2147024809, System.ArgumentException",
"message": "Invalid attribute update\r\nParameter name: attributeUpdates",
"innerError": {
"request-id": "1be313f3-880b-47de-858d-1bea74951715",
"date": "2017-03-06T09:29:21"
}
}
}
However, when I attempt to update the schools collection, which is also a String collection, this works without issue.
This is the same with both beta and v1.0 and also with the /me endpoint rather than /users/<upn>.
Is this a bug within the API?
Any ideas about how to set this?
Thanks in advance.
I am also able to reproduce this issue too. Based on the error message, it seems this attribute is not support update at current version of Microsoft Graph.
If you want to this attribute is update-able, I suggest that you submit the feedback from here.

Unable to update organization properties

I've encountered a problem while trying to update organization's properties using Microsoft Graph API. I've followed these docs and tried it in graph explorer.
My request looks like this:
{ "displayName": "My Company Name" }
Whatever I do I always get the following error:
"error": {
"code": "Request_BadRequest",
"message": "Specified HTTP method is not allowed for the request target.",
"innerError": {
"request-id": "dfd9ae19-2774-4b10-8d74-f6f6cd21f712",
"date": "2016-05-16T14:48:02"
}
}
What am I doing wrong?
I have tried in my test tenant and results in the same error.
https://graph.microsoft.io/en-us/docs/api-reference/v1.0/resources/organization
In the above document it is mentioned that we can update "marketingNotificationMails" and "technicalNotificationMails" properties alone through Update API. So I think you can't update the organization display name.
It does appear as though updates are limited on the organization entity. Please file a request to Uservoice to ask for this feature.

Resources