How to get message with Microsoft Graph API?

Chong Liu 40 Reputation points
2024-01-15T09:56:38.57+00:00

I get message with https://graph.microsoft.com/v1.0/me/messages/{id}, and received a failed response [{"error":{"code":"RequestBroker--ParseUri","message":"Resource not found for the segment '0ueZLRLCGQC0vORhuAAACAQwAAACBn2'."}}] the mail id is AQMkADAwATMwMAItNjFiYgAtZmQ4NS0wMAItMDAKAEYAAAPjXnns9wvNTped4ldGQ4AYBwCBn2/0ueZLRLCGQC0vORhuAAACAQwAAACBn2/0ueZLRLCGQC0vORhuAAAActZeJgAAAA==, and contains / character.

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jagan Rajagopal 0 Reputation points
    2024-01-15T10:30:03.38+00:00

    Please find the troubleshoot step as mention in below

    1. URL Encoding: The message ID contains special characters, including the "/" character, which need to be URL encoded when used in a URL. In a URL, the "/" character is reserved as a path segment delimiter, so it must be percent-encoded
    2. Correctly Format the API Request: Ensure the message ID is properly encoded in your API request
    3. Retry the API Request: Once the message ID is properly encoded, retry the API request with the updated URL. 4.Access Permissions: Ensure that the token you are using has the appropriate permissions to access the message. 5.Check for API Changes: Sometimes, API endpoints or requirements change. Make sure to check for any recent updates or changes in the Microsoft Graph API that might affect how you should format your request.

  2. CarlZhao-MSFT 46,371 Reputation points
    2024-01-16T02:15:44.1533333+00:00

    Hi @Chong Liu

    Only the slash character (/) needs to be encoded, the '==' character does not need to be encoded.

    The encoded message id should be:

    https://graph.microsoft.com/v1.0/me/messages/AQMkADAwATMwMAItNjFiYgAtZmQ4NS0wMAItMDAKAEYAAAPjXnns9wvNTped4ldGQ4AYBwCBn2%2F0ueZLRLCGQC0vORhuAAACAQwAAACBn2%2F0ueZLRLCGQC0vORhuAAAActZeJgAAAA==
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


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.