Send adaptive card via Graph Mail
Dear community A third-party monitoring application creates static adaptive cards when an alert is triggered. This application calls a PowerShell script and provides a couple parameters including the adaptive card json. I have now tried to pack this adaptive card into a html email and send it via Graph API. Sadly I cannot get it to render the adaptive card for example in Outlook. HTML message <html> <head> <metahttp-equiv="Content-Type"content="text /html;charset=utf-8"> <scripttype='application /adaptivecard+json'> {"type":"AdaptiveCard","version":"1.4","hideOriginalBody":true,"body":[{...}]} </script> </head> <body> </body> </html> Graph Mail $emailRecipients = @( 'email address removed for privacy reasons' ) [array]$toRecipients = ConvertTo-IMicrosoftGraphRecipient -SmtpAddresses $emailRecipients $emailSender = 'email address removed for privacy reasons' $emailSubject = "Sample Email AdaptiveCard" $emailBody = @{ ContentType = 'html' Content = Get-Content -Path 'C:\...\adaptivecard.html' } $body += @{subject = $emailSubject} $body += @{toRecipients = $toRecipients} $body += @{body = $emailBody} $bodyParameter += @{'message' = $body} $bodyParameter += @{'saveToSentItems' = $false} Send-MgUserMail -UserId $emailSender -BodyParameter $bodyParameter I am grateful for any advice or help with this problem. Many thanks Simon260Views0likes0CommentsIs it possible to insert an actionable message in an existing email message?
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 https://learn.microsoft.com/en-us/outlook/actionable-messages/adaptive-card#refresh-cards 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 🙂677Views0likes0CommentsCreate event in user calendar invites room - rooms responds in another language
I have an daemon graph app. It creates events in user calendar and invites room. Everything works fine but room responds always in English. When I create event manually through outlook, room responds in my language. How can I define preferred language for create event request or daemon app?445Views0likes0Comments