Sdílet prostřednictvím


Aktualizace aktivity

Poznámka:

Vytváříte scénáře Copilotu, Teams nebo Outlooku s využitím adaptivních karet? Navštivte Adaptive Card Documentation Hub, nové komplexní centrum pro všechny vaše potřeby týkající se adaptivních karet! Obsahuje všechny prostředky, které hledáte, včetně kompletní dokumentace pro řadu nových funkcí, jako je responzivní rozložení, ikona, odznáček, karusely, grafy a mnoho dalšího.

Tyto vzorky jsou pouze teaser typu karet, které můžete vytvořit. Pokračujte a vylepšete je, aby byly možné všechny scénáře!

Důležitá poznámka týkající se přístupnosti: Ve verzi 1.3 schématu jsme zavedli vlastnost popisku u vstupů za účelem zlepšení přístupnosti. Pokud hostitelská aplikace, na kterou cílíte, podporuje verzi 1.3, měli byste místo TextBlock použít label, jak je vidět v některých níže uvedených příkladech. Po aktualizaci většiny hostitelských aplikací na nejnovější verzi ukázky odpovídajícím způsobem aktualizujeme.

Ukázka aktualizace aktivity

Následující část zobrazuje JSON pro ukázku adaptivní karty "Aktualizace aktivity", zobrazenou s a bez využití šablon.

Kód JSON (bez šablony)

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"
					}
				]
			}
		}
	]
}

Kód JSON (s šablonováním)

Data 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" }
	]
}

Template 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"
}