Getting Error Code: ErrorInvalidUser when trying to get message using GET /v1.0/users/{user-email}/messages/{message-id}

Piyumi Perera 101 Reputation points

I am using an Outlook Add-in which follows SSO as the authentication service and On Behalf Of Flow as the authentication grant flow . When retrieving the message using graph API I am getting following error for some Azure AD users.

Code: ErrorInvalidUser  
Message: The requested user '' is invalid.  


I am using following API call to get message.{user-email}/messages/{message-id}?$select=subject%2C%20body%2C%20internetmessageheaders%2C%20parentFolderId

They are using Microsoft O365 MSO (Cloud) offering a Microsoft Office E3 license.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,062 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
17,598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhanu Kiran 3,521 Reputation points

    Hi @Piyumi Perera ,

    The above error code tells that the above user is invalid or doesn't exist. Check whether the user exists in

    If the user exists, using this endpoint GET, you can query all the users in your tenant. In the response, The response contains id and userPrincipalName that can be used to request the /messages endpoint. Have you tried using other users on this issue?

    You can refer to this documentation to get a token.

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".