Skip to content

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

@corinagum

Description

@corinagum

@copilot In Microsoft.Teams.Api, AttachmentLayout needs to be TWO types, not one renamed type. Background: teams.ts attempted the rename in microsoft/teams.ts#381 (merged 2025-10-25) and then REVERTED it in microsoft/teams.ts#382 (merged 2025-10-29) once it became clear that:

  • Activity / Message layout on the wire is list | carousel
  • MessageExtension Result layout on the wire is list | grid
  • Needs to be done for /Libraries and /core

Current teams.ts main reflects this split — see packages/api/src/models/attachment/attachment-layout.ts ('list' | 'carousel') and
packages/api/src/models/messaging-extension/messaging-extension-attachment-layout.ts ('list' | 'grid').

Mirror that split in teams.net. Specifically:

  1. Leave Libraries/Microsoft.Teams.Api/Attachment.cs Layout class unchanged — it must keep List and Carousel (for Activity/Message use). Do NOT rename Carousel to Grid.

  2. Add a new strong-enum type Microsoft.Teams.Api.MessageExtensions.AttachmentLayout with only List ("list") and Grid ("grid"), following the existing StringEnum pattern used elsewhere (e.g., the existing Attachment.Layout). Place it under Libraries/Microsoft.Teams.Api/MessageExtensions/ alongside Attachment.cs (which already extends Api.Attachment — same parallel-type pattern applies here).

  3. Change Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs:45 from Api.Attachment.Layout? to the new MessageExtensions.AttachmentLayout?.

  4. Do NOT touch:

    • Libraries/Microsoft.Teams.Api/Messages/Message.cs (still uses Attachment.Layout — correct)
    • Libraries/Microsoft.Teams.Api/Activities/Message/MessageActivity.cs (still uses Attachment.Layout — correct)
    • samples or tests unless required by step 3
  5. Run dotnet build and dotnet format before pushing. Ensure the new file ends with a trailing newline.

This is a NON-breaking change (the new type is additive; Result.AttachmentLayout's assignable values were already constrained to list/grid in practice, and the property type on a JSON-serialized class swap is source-compatible for typical usage where callers passed Attachment.Layout.List).

In the PR description, link both microsoft/teams.ts#381 and microsoft/teams.ts#382, and explicitly note that #381 was reverted. This is the context that was lost in #193 and #488.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions