I have a problem with adaptive card refresh via Outlook email. I am implementing an action button in an Outlook email. I using the .net4.5 WCF to call the refresh services and try to refresh the cards. My adaptive cards version is set to 1.0 and JSON payloads are designed from MS adaptiveCards Designer here .
After clicking the "Accept" action button via email.
It shows this error every time and the cards are not changed.
WCF:
[OperationContract]
[WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
JSONObject adaptiveCardsRefresh();
adaptiveCardsRefresh method:
public JSONObject adaptiveCardsRefresh()
{
JSONObject obj = new JSONObject();
var jsonStr = GetAdaptiveCardContent("workFlowEmailApproved.json");
obj = JsonConvert.DeserializeObject<JSONObject>(jsonStr);
WebOperationContext.Current.OutgoingResponse.Headers.Add("CARD-UPDATE-IN-BODY", "true");
WebOperationContext.Current.OutgoingResponse.ContentType = "application/json";
return obj;
}
workFlowEmailApproved.json (already tested in MS Adaptivecards Designer):
{
"type": "AdaptiveCard",
"version": "1.0",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"originator": "<my-originator-id>",
"body": [
{
"type": "TextBlock",
"text": "The action has been recorded."
}
]
}
I try to log out the return object, it seems normal as a valid JSON format:
Return SerializeObject: {"type":"AdaptiveCard","$schema":"http://adaptivecards.io/schemas/adaptive-card.json","originator":"<my-originator-id>","body":[{"type":"TextBlock","text":"The action has been recorded."}]}
I think in your request you need to make sure that your post request has the following headers
When I didn't have the Authorization header I got similar error messages. I think this is because Outlook automatically sends its own Bearer token otherwise
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.