HtmlWidgetHelpers Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Helper methods for building and validating HTML widget messages.
public static class HtmlWidgetHelpers
type HtmlWidgetHelpers = class
Public Class HtmlWidgetHelpers
- Inheritance
-
HtmlWidgetHelpers
Methods
| Name | Description |
|---|---|
| BuildHtmlWidgetMarkdown(HtmlWidgetPayload, HtmlWidgetMarkdownOptions) |
Wraps an HTML widget payload in the ```html-widget markdown code fence format required by Teams to render the widget in a message. |
| BuildHtmlWidgetMessage(HtmlWidgetPayload, HtmlWidgetMarkdownOptions) |
Builds a message activity containing an HTML widget, ready to be sent. |
| InjectWidgetProtocol(String, InjectWidgetProtocolOptions) |
Injects the MCP Apps protocol script into widget HTML. If the HTML already contains the protocol (detected by "ui/initialize"), it is returned unchanged. |
| TryGetWidgetModelContext(MessageActivity) |
Attempts to extract an MCP UI update-model-context request from a message
activity's |
| ValidateSecurityPolicy(String, HtmlWidgetSecurityPolicy) |
Validates that external references in widget HTML are covered by the declared security policy. Returns a list of warnings for any references to origins not present in the appropriate policy field. |