[英]How to echo user select optionset from ChoiceSet using messageBack or imBack?
我正在嘗試使用 messageBack 或 imBack(以可能的方式)從給定的用戶評級下拉列表中回顯用戶選擇的選項。 因為,我只能在 messageBack 值字段中添加靜態文本作為值
"actions": [
{
"type": "Action.Submit",
"title": "OK",
"data": {
"msteams": {
"type": "imBack",
"value": "User selected option"
}
}
}
]
有沒有辦法可以從選擇集中獲取值並顯示在 MS Teams 上使用 messageBack?
您可以在此處參考完整的 JSON:
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"color": "Accent",
"text": "Rate your experience!"
},
{
"type": "TextBlock",
"separator": true,
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"id": "CompactSelect",
"label": "What color do you want? (compact)",
"style": "compact",
"isRequired": true,
"errorMessage": "This is a required input",
"placeholder": "Please choose",
"choices": [
{
"title": "⭐⭐⭐⭐⭐",
"value": "⭐⭐⭐⭐⭐"
},
{
"title": "⭐⭐⭐⭐",
"value": "⭐⭐⭐⭐"
},
{
"title": "⭐⭐⭐",
"value": "⭐⭐⭐"
},
{
"title": "⭐⭐",
"value": "⭐⭐"
},
{
"title": "⭐",
"value": "⭐"
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK",
"data": {
"msteams": {
"type": "imBack",
"value": "User selected option"
}
}
}
]
}
@ user30 - 你能檢查一下這個代碼嗎?
var InputChoices = new List<AdaptiveChoice> {
new AdaptiveChoice() { Title = "Red",
Value = "Red" },
new AdaptiveChoice() { Title = "Green",
Value = "Green" },
new AdaptiveChoice() { Title = "White",
Value = "White" },
new AdaptiveChoice() { Title = "Black",
Value = "Black" }
};
return new AdaptiveCard()
{
Body = new List<AdaptiveElement>()
{
new AdaptiveColumnSet()
{
Columns=new List<AdaptiveColumn>()
{
new AdaptiveColumn()
{
Items=new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text="Colors",
Id="colorCodeId",
Spacing=AdaptiveSpacing.None,
Wrap=true
}
}
},
new AdaptiveColumn()
{
Items=new List<AdaptiveElement>()
{
new AdaptiveChoiceSetInput()
{
Id="colorCodeId",
Spacing=AdaptiveSpacing.None,
Choices=new List<AdaptiveChoice>(InputChoices),
Style=AdaptiveChoiceInputStyle.Compact
}
}
}
}
},
},
Actions = new List<AdaptiveAction>()
{
new AdaptiveSubmitAction
{
Type = AdaptiveSubmitAction.TypeName,
Title = "Submit"
},
},
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.