From 3c6cdc1dac0795b3cca3e8f2ad4f83cb8bbad009 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 18:28:30 +0000 Subject: [PATCH 1/2] Initial plan From d1314356abdb3c03f60b6fab31b848b55dce5b0a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 18:31:42 +0000 Subject: [PATCH 2/2] Split MessageExtensions AttachmentLayout (list|grid) from Attachment.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> --- .../MessageExtensions/AttachmentLayout.cs | 24 +++++++++++++++++++ .../MessageExtensions/Result.cs | 2 +- Samples/Samples.MessageExtensions/Program.cs | 12 +++++----- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 Libraries/Microsoft.Teams.Api/MessageExtensions/AttachmentLayout.cs diff --git a/Libraries/Microsoft.Teams.Api/MessageExtensions/AttachmentLayout.cs b/Libraries/Microsoft.Teams.Api/MessageExtensions/AttachmentLayout.cs new file mode 100644 index 000000000..e09797dd2 --- /dev/null +++ b/Libraries/Microsoft.Teams.Api/MessageExtensions/AttachmentLayout.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +using Microsoft.Teams.Common; + +namespace Microsoft.Teams.Api.MessageExtensions; + +/// +/// Hint for how to deal with multiple attachments in a messaging extension result. +/// Possible values include: 'list', 'grid'. +/// +[JsonConverter(typeof(StringEnum.JsonConverter))] +public class AttachmentLayout(string value) : StringEnum(value) +{ + public static readonly AttachmentLayout List = new("list"); + [JsonIgnore] + public bool IsList => List.Equals(Value); + + public static readonly AttachmentLayout Grid = new("grid"); + [JsonIgnore] + public bool IsGrid => Grid.Equals(Value); +} diff --git a/Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs b/Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs index f7dc401ac..5995c6b96 100644 --- a/Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs +++ b/Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs @@ -42,7 +42,7 @@ public class Result /// [JsonPropertyName("attachmentLayout")] [JsonPropertyOrder(0)] - public Api.Attachment.Layout? AttachmentLayout { get; set; } + public AttachmentLayout? AttachmentLayout { get; set; } /// /// The type of the result. Possible values include: diff --git a/Samples/Samples.MessageExtensions/Program.cs b/Samples/Samples.MessageExtensions/Program.cs index a82cd5592..38048b706 100644 --- a/Samples/Samples.MessageExtensions/Program.cs +++ b/Samples/Samples.MessageExtensions/Program.cs @@ -60,7 +60,7 @@ ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = new List() } }); @@ -198,7 +198,7 @@ static Microsoft.Teams.Api.MessageExtensions.Response CreateSearchResults(string ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = attachments } }; @@ -233,7 +233,7 @@ static Microsoft.Teams.Api.MessageExtensions.Response HandleCreateCard(JsonEleme ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = new List { attachment } } }; @@ -268,7 +268,7 @@ static Microsoft.Teams.Api.MessageExtensions.Response HandleGetMessageDetails(Mi ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = new List { attachment } } }; @@ -303,7 +303,7 @@ static Microsoft.Teams.Api.MessageExtensions.Response CreateLinkUnfurlResponse(s ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = new List { attachment } } }; @@ -335,7 +335,7 @@ static Microsoft.Teams.Api.MessageExtensions.Response CreateItemSelectionRespons ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result { Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result, - AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List, + AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List, Attachments = new List { attachment } } };