[英]AdaptiveCards action refresh cards does not work using C# WCF Services
我在通過 Outlook email 刷新自適應卡片時遇到問題。我在 Outlook email 中實現了一個操作按鈕。我使用 .net4.5 WCF 調用刷新服務並嘗試刷新卡片。 我的自適應卡版本設置為 1.0,JSON 有效負載是從此處的 MS adaptiveCards Designer 設計的。
通過 email 單擊“接受”操作按鈕后。
它每次都顯示此錯誤並且卡沒有更改。
WCF:
[OperationContract]
[WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
JSONObject adaptiveCardsRefresh();
adaptiveCardsRefresh 方法:
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 (已在 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."
}
]
}
我嘗試注銷返回 object,作為有效的 JSON 格式似乎很正常:
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."}]}
我認為在您的請求中,您需要確保您的帖子請求具有以下標頭
當我沒有授權 header 時,我收到了類似的錯誤消息。 我認為這是因為 Outlook 否則會自動發送自己的 Bearer 令牌
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.