CompactToken parsing failed with error code: 80049217

Sajith Gopalakrishnan Hema 1,056 Reputation points
2023-01-11T16:25:37.4+00:00

Using the Postman, the user is trying to access the below URL

https://graph.microsoft.com/v1.0/me/micrsoft.graph.sendmail

Authorization type : Basic

User Name and Passwords are provided

But getting the below error

CompactToken parsing failed with error code: 80049217

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

Accepted answer
  1. CarlZhao-MSFT 46,371 Reputation points
    2023-01-12T09:31:09.1133333+00:00

    Hi @Sajith Gopalakrishnan Hema

    The https://graph.microsoft.com/v1.0/me/micrsoft.graph.sendmail is not a valid API endpoint, if you want to call the graph API to send email, the correct endpoint should be:

    POST https://graph.microsoft.com/v1.0/me/sendMail
    Content-type: application/json
    
    {
      "message": {
        "subject": "Meet for lunch?",
        "body": {
          "contentType": "Text",
          "content": "The new cafeteria is open."
        },
        "toRecipients": [
          {
            "emailAddress": {
              "address": "******@contoso.onmicrosoft.com"
            }
          }
        ],
        "ccRecipients": [
          {
            "emailAddress": {
              "address": "******@contoso.onmicrosoft.com"
            }
          }
        ]
      },
      "saveToSentItems": "false"
    }
    

    You can put your access token in the Authorization parameter:

    30

    Send mail:

    31


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


1 additional answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,826 Reputation points
    2023-01-11T21:55:03.46+00:00

    Hello @Sajith Gopalakrishnan Hema

    Thanks for reaching out!

    This error message "CompactToken parsing failed with error code: 80049217" generally occurs when the token used is invalid. I'm able to reproduce the error message when I'm passing token in a wrong way (in request headers). The correct way to pass a token in a parameter is (“Bearer”+space+token ).

    Please refer to this similar post.

    Hope this helps.

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

    1 person found this answer helpful.
    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.