Skip to content

Split MessageExtensions AttachmentLayout (list|grid) from Attachment.Layout (list|carousel)#503

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/change-attachmentlayout-carousel-to-grid
Draft

Split MessageExtensions AttachmentLayout (list|grid) from Attachment.Layout (list|carousel)#503
Copilot wants to merge 2 commits into
mainfrom
copilot/change-attachmentlayout-carousel-to-grid

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

Microsoft.Teams.Api.Attachment.Layout was being reused for both Activity/Message attachments (wire values list | carousel) and MessageExtension Result attachments (wire values list | grid). These are two distinct enums on the wire and need two distinct types.

This mirrors the split in teams.ts — the rename attempt in microsoft/teams.ts#381 (merged 2025-10-25) was reverted in microsoft/teams.ts#382 (merged 2025-10-29) in favor of two parallel types. That context was lost in #193 and #488 (and a related rename in #381).

Changes

  • New type Libraries/Microsoft.Teams.Api/MessageExtensions/AttachmentLayout.csStringEnum with List ("list") and Grid ("grid"), following the existing Attachment.Layout pattern.
  • MessageExtensions/Result.csAttachmentLayout property retyped from Api.Attachment.Layout? to the new MessageExtensions.AttachmentLayout?.
  • Samples/Samples.MessageExtensions/Program.cs — six call sites updated to the new type (required by the property retype).
  • Untouched: Attachment.cs (List / Carousel preserved), Messages/Message.cs, Activities/Message/MessageActivity.cs.
// MessageExtensions result — was Api.Attachment.Layout.List
new Microsoft.Teams.Api.MessageExtensions.Result
{
    Type = ResultType.Result,
    AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
    Attachments = [...]
};

// Message activity — unchanged, still uses Attachment.Layout
message.WithAttachmentLayout(Microsoft.Teams.Api.Attachment.Layout.Carousel);

Non-breaking: the new type is additive, and Result.AttachmentLayout assignable values were already constrained to list/grid in practice. JSON wire format is unchanged.

…Layout (list|carousel)

Agent-Logs-Url: https://github.com/microsoft/teams.net/sessions/10784387-fb02-4ea9-bbe2-70add2826380

Co-authored-by: corinagum <14900841+corinagum@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AttachmentLayout type to replace 'carousel' with 'grid' Split MessageExtensions AttachmentLayout (list|grid) from Attachment.Layout (list|carousel) May 13, 2026
Copilot AI requested a review from corinagum May 13, 2026 18:32
@corinagum corinagum requested a review from singhk97 May 13, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change AttachmentLayout type to replace 'carousel' with correct value: 'grid'

2 participants