Is it possible to insert an actionable message in an existing email message?

Occasional Visitor
 
I want to insert an actionable message in an existing email using Microsoft Graph API.

The message to be rewritten does not contain an actionable message. Is it possible to insert an existing actionable message in an existing email message?

When I update the message with the API, the body of the message is modified but the actionable message does not appear.

I have the impression that Outlook checks the presence and interprets the actionable message when it receives the email. But when I edit an existing message, it will not check the existence of an actionable message.

I tested the following cases:

  • Send a new message containing the same body -> it works
  • Modify an existing actionable message -> it works with documentation
  • Modify an existing emailMessage with random body without actionable message-> It works

The debugger's diagnostics show me this :

 

{"CardEnabledForMessage": false,
"ClientName": "OutlookWebApp",
"ClientVersion": "20221111004.15",
"InternetMessageId": "<email address removed for privacy reasons>",
"EntityExtractionSuccess": true,
-"AdaptiveCardPayload": {
"found": true,
"type": "AdaptiveCard"
},
-"MessageCardPayload": {
"found": false,
"type": null
},
-"AuthHeader": {
"results": "dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fakedomain.onmicrosoft.com;",
"authAs": "Internal"
}
}

 

 

Code for path message :

 

def update_message(
    self, data: DataEvent, office_message_body: OfficeMessageBody
) -> int:
    """
    https://learn.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0&tabs=http#http-request
    """
    url = f"/users/{data.id_user}/messages/{data.id_message}"
    response = self.microsoft_api.patch(
        url=url,
        json={"body": office_message_body.dict()},
        headers={
            "CARD-UPDATE-IN-BODY": "true",
        },
    )
    return response.status_code

 

Content of body : 

 

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script type="application/adaptivecard+json">{
    "type": "AdaptiveCard",
    "version": "1.0",
    "originator": "DONT_DISPLAY_IN_STACKOVERFLOW",
    "body": [
      {
        "type": "TextBlock",
        "text": "Visit the Outlook Portal",
        "size": "large"
      },
      {
        "type": "TextBlock",
        "text": "Click **Learn More** to learn more about Actionable Messages!"
      },
      {
        "type": "Input.Text",
        "id": "feedbackText",
        "placeholder": "Let us know what you think about Actionable Messages"
      }
    ]
  }
  </script>
</head>
<body>
test Modify message
</body>
</html>

 


Thank you :)


0 Replies