microsoft / microsoft/teams.net

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

Open
#502 0 comments 1 reaction 2 assignees Claimed by @corinagum View on GitHub
Dominant language
C#
Stars
46
Forks
21
Avg merge
22h 25m
Merged PRs (30d)
16

Description

@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 microsoft/teams.net#193 and #488.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.