Got follow error when using graph API create chat: "Failed to get license information for the user. Ensure user has a valid Office365 license assigned to them"

Yi Huang 黃懿 11 Reputation points
2022-10-07T07:57:26.47+00:00

Currently using the delegated permission with an AAD account logged in to create chat for Teams users.

What have done are the belows

  1. The user is able to login to MS Teams.
  2. My app client have got the follwing permissions:
    User.ReadBasic.All,
    TeamsActivity.Send,
    Chat.ReadWrite,
    ChannelMessage.Send
    User.Read.All
  3. My AAD account have been granted the Teams administration role.
  4. The test is made on Postman, and have gotten a token from OAuth2.

248461-image.png

(1) My first question is , according to this page permissions-reference, the API will do if granted the suited permission.
However, the error that recieved from Postman tells that the User.Read.All permission, which is not mentioned needed for the create chat API, is also needed.
It's important for me to know associated information since applying for permission in the company that I worked for required great efforts and careful look.

248389-image.png

(2) My second question is, the error message tells that there is still needed to "consent as user or Grant admin consent in portal".
But I've already signed in OAuth through my AAD account and passwd and gave the app secrets, id.

(3) The last question, is O365 essential for creating Teams chat? 248405-image.png
Since the error message also tells this.
Should the O365 be added on the AAD account, the app client or the target Teams user?

It's quite urgent, please help.
Thank you so much for reading this issue.

Microsoft Teams Development
Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Graph
{count} votes

3 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,366 Reputation points
    2022-10-11T08:16:43.333+00:00

    Hi @Yi Huang 黃懿

    Does the signed-in user have an O365 license? Please check:

    Go to Azure AD>Users > find your users> Licenses make sure your users have been granted O365 licenses.

    249216-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Meghana-MSFT 4,116 Reputation points Microsoft External Staff
    2022-10-12T10:09:31.56+00:00
    1. The API would work if the permissions mentioned in the doc are given. I tried creating chat in postman using application permissions. As mentioned in Create Chat, Chat.Create application permission is sufficient. 249619-image.png
    2. Admin needs to consent to the permissions and then you can get the token. 249705-image.png
    3. O365 license is required. As mentioned by CarlZhao-MSFT please verify the user's license.

  3. Ivelk 1 Reputation point
    2022-12-15T20:05:59.883+00:00

    Hello @Yi Huang 黃懿 ,

    Check Apps under E3 License. I had same issue and somehow MS Teams was not checked.
    After that i got it working.

    271137-image.png

    271106-image.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.