共用方式為


活動更新

備註

你正在建立由 Adaptive Cards 驅動的 Copilot、Teams 或 Outlook 應用場景嗎? 造訪 Adaptive Card Documentation Hub,這個全新的一站式平台,滿足您所有 Adaptive Card 的需求! 它擁有你所需的所有資源,包括許多新功能的完整文件,例如響應式版面、圖示徽章旋轉木馬圖表等等!

這些範例只是你可以製作卡片類型的 預告 。 去調整它們,使任何情境都能實現!

關於無障礙的重要說明: 在結構的 1.3 版本中,我們在 Inputs 上引入 了標籤 屬性以提升可及性。 如果你目標的 主機應用程式 支援 v1.3,建議使用 label 而非 TextBlock ,如下方範例所示。 當大多數 Host 應用程式更新到最新版本後,我們會相應更新樣本。

活動更新範例

以下章節展示「活動更新」自適應卡片範例的 JSON,其中顯示使用模板和不使用模板的情況。

JSON 程式碼(無模板)

JSON

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.5",
	"body": [
		{
			"type": "TextBlock",
			"text": "Publish Adaptive Card schema",
			"weight": "bolder",
			"size": "medium",
			"wrap": true,
			"style": "heading"
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"width": "auto",
					"items": [
						{
							"type": "Image",
							"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
							"altText": "Matt Hidinger",
							"size": "small",
							"style": "person"
						}
					]
				},
				{
					"type": "Column",
					"width": "stretch",
					"items": [
						{
							"type": "TextBlock",
							"text": "Matt Hidinger",
							"weight": "bolder",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"spacing": "none",
							"text": "Created {{DATE(2017-02-14T06:08:39Z, SHORT)}}",
							"isSubtle": true,
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "TextBlock",
			"text": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
			"wrap": true
		},
		{
			"type": "FactSet",
			"facts": [
				{
					"title": "Board:",
					"value": "Adaptive Card"
				},
				{
					"title": "List:",
					"value": "Backlog"
				},
				{
					"title": "Assigned to:",
					"value": "Matt Hidinger"
				},
				{
					"title": "Due date:",
					"value": "Not set"
				}
			]
		}
	],
	"actions": [
		{
			"type": "Action.ShowCard",
			"title": "Set due date",
			"card": {
				"type": "AdaptiveCard",
				"body": [
					{
						"type": "Input.Date",
						"label": "Enter the due date",
						"id": "dueDate"
					}
				],
				"actions": [
					{
						"type": "Action.Submit",
						"title": "Send"
					}
				]
			}
		},
		{
			"type": "Action.ShowCard",
			"title": "Comment",
			"card": {
				"type": "AdaptiveCard",
				"body": [
					{
						"type": "Input.Text",
						"id": "comment",
						"isMultiline": true,
						"label": "Add a comment"
					}
				],
				"actions": [
					{
						"type": "Action.Submit",
						"title": "OK"
					}
				]
			}
		}
	]
}

JSON 程式碼(含模板)

資料 JSON

{
	"title": "Publish Adaptive Card Schema",
	"description": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
	"creator": {
		"name": "Matt Hidinger",
		"profileImage": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg"
	},
	"createdUtc": "2017-02-14T06:08:39Z",
	"viewUrl": "https://adaptivecards.io",
	"properties": [
		{ "key": "Board", "value": "Adaptive Cards" },
		{ "key": "List", "value": "Backlog" },
		{ "key": "Assigned to", "value": "Matt Hidinger" },
		{ "key": "Due date", "value": "Not set" }
	]
}

範本 JSON

{
	"type": "AdaptiveCard",
	"body": [
		{
			"type": "TextBlock",
			"size": "medium",
			"weight": "bolder",
			"text": "${title}",
			"style": "heading",
			"wrap": true
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"items": [
						{
							"type": "Image",
							"style": "person",
							"url": "${creator.profileImage}",
							"altText": "${creator.name}",
							"size": "small"
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"weight": "bolder",
							"text": "${creator.name}",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"spacing": "none",
							"text": "Created {{DATE(${string(createdUtc)}, SHORT)}}",
							"isSubtle": true,
							"wrap": true
						}
					],
					"width": "stretch"
				}
			]
		},
		{
			"type": "TextBlock",
			"text": "${description}",
			"wrap": true
		},
		{
			"type": "FactSet",
			"facts": [
				{
					"$data": "${properties}",
					"title": "${key}:",
					"value": "${value}"
				}
			]
		}
	],
	"actions": [
		{
			"type": "Action.ShowCard",
			"title": "Set due date",
			"card": {
				"type": "AdaptiveCard",
				"body": [
					{
						"type": "Input.Date",
						"label": "Enter the due date",
						"id": "dueDate"
					},
					{
						"type": "Input.Text",
						"id": "comment",
						"isMultiline": true,
						"label": "Add a comment"
					}
				],
				"actions": [
					{
						"type": "Action.Submit",
						"title": "OK"
					}
				],
				"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
			}
		},
		{
			"type": "Action.OpenUrl",
			"title": "View",
			"url": "${viewUrl}",
			"role": "button"
		}
	],
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"version": "1.5"
}