Core/activity extensions#515
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors “activity extensions” in Microsoft.Teams.Apps by moving entity-manipulation helpers into entity-scoped extension types, expanding fluent APIs for MessageActivity/TeamsActivityBuilder, and updating tests/docs/samples to the new APIs.
Changes:
- Introduces entity-scoped extension helpers (e.g., quoted replies, targeted message info, stream info, citations, mentions) and routes builder methods through them.
- Expands
MessageActivityExtensionswith many fluentWith*/Add*helpers and adjusts builder behavior around typedMessageActivityfields. - Updates unit tests, migration docs, and samples to reflect renamed/relocated APIs (e.g.,
WithQuote→AddQuote, targeted message info changes).
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| core/test/Microsoft.Teams.Apps.UnitTests/TeamsActivityTests.cs | Updates/reshapes activity conversion/serialization tests; adds coverage for derived/base conversion behavior. |
| core/test/Microsoft.Teams.Apps.UnitTests/TeamsActivityBuilderTests.cs | Adds builder tests for WithFrom syncing, duplicate JSON keys, and new builder entity helpers. |
| core/test/Microsoft.Teams.Apps.UnitTests/TargetedMessageInfoEntityTests.cs | Updates tests to use MessageActivity and AddQuote naming. |
| core/test/Microsoft.Teams.Apps.UnitTests/QuotedReplyEntityTests.cs | Renames builder API usage to AddQuote. |
| core/test/Microsoft.Teams.Apps.UnitTests/MessageActivityTests.cs | Adjusts message mapping/serialization assertions (adds From/Recipient checks, removes commented assertions). |
| core/test/Microsoft.Teams.Apps.UnitTests/CitationEntityTests.cs | Migrates citation/feedback tests to MessageActivity and adds feedback-mode test. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsConversationAccount.cs | Promotes Teams account fields (AAD/user details) to typed JSON properties and changes conversion logic. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsConversation.cs | Updates conversation conversion to use Extract<T> for known Teams fields. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsChannelData.cs | Removes the TeamsChannelData(ChannelData?) conversion constructor. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsActivityBuilder.cs | Routes quoting/targeted-message/mention logic through new entity extension helpers; adds new builder “Add*” helpers. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsActivity.cs | Removes TeamsActivity.AddEntity and keeps builder-based creation as the primary path. |
| core/src/Microsoft.Teams.Apps/Schema/StreamingActivity.cs | Switches stream entity creation to StreamInfoEntityExtensions. |
| core/src/Microsoft.Teams.Apps/Schema/MessageActivityExtensions.cs | Adds extensive fluent APIs for MessageActivity and routes entity operations through new helpers. |
| core/src/Microsoft.Teams.Apps/Schema/MessageActivity.cs | Removes commented legacy property extraction and commented-out properties. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/TargetedMessageInfoEntity.Extensions.cs | New helper for targeted message info (add/get + quote placeholder stripping). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/StreamInfoEntity.Extensions.cs | New helper for stream info entity/channelData wiring. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/StreamInfoEntity.cs | Minor formatting change. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/SensitiveUsageEntity.Extensions.cs | New helper to add/get sensitivity label entities. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/QuotedReplyEntity.Extensions.cs | New helper to add/get quoted reply entities + placeholder handling. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/ProductInfoEntity.Extensions.cs | New helper to add/get product info entity. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/OMessageEntity.Extensions.cs | New helper to get/create root schema.org message entity and apply AI-generated labels. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/MentionEntity.Extensions.cs | New helper to add/get mention entities and optionally prepend mention text. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/MentionEntity.cs | Removes the old ActivityMentionExtensions block (moved to new extensions file). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/ClientInfoEntity.Extensions.cs | New helper to add/get client info entity. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/ClientInfoEntity.cs | Removes the old ActivityClientInfoExtensions block (moved to new extensions file). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/CitationEntity.Extensions.cs | New helper to add/get citation entity built from the root message entity. |
| core/src/Microsoft.Teams.Apps/Schema/Entities/CitationEntity.cs | Removes the old ActivityCitationExtensions block (moved to new extensions files). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/ActivityTargetedMessageInfoExtensions.cs | Deletes prior targeted-message-info implementation (replaced by new entity extensions). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/ActivityQuotedReplyExtensions.cs | Deletes prior quoted-reply implementation (replaced by new entity extensions). |
| core/src/Microsoft.Teams.Apps/Context.cs | Updates targeted-message-info injection to use the new helper. |
| core/samples/TeamsBot/Program.cs | Updates citation sample to use builder-based fluent APIs. |
| core/samples/Quoting/Program.cs | Updates quoting sample to use AddQuote via builder and removes the old WithQuote builder demo. |
| core/samples/AllFeatures/Program.cs | Removes the AllFeatures sample. |
| core/samples/AllFeatures/appsettings.json | Removes AllFeatures sample config. |
| core/samples/AllFeatures/AllFeatures.http | Removes AllFeatures sample HTTP file. |
| core/samples/AllFeatures/AllFeatures.csproj | Removes AllFeatures sample project file. |
| core/docs/ReduceBreakingChangesPlan.md | Updates plan narrative to reflect new extension APIs. |
| core/docs/MigrationGuide.md | Updates migration guidance around entity getters and fluent APIs. |
| core/core.slnx | Removes a docs file reference from the solution items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rido-min
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request primarily refactors and streamlines how activity entity extension methods are organized, accessed, and documented in the Teams SDK core. It consolidates and migrates extension methods for activities (such as quoting, citations, and targeted messages), updates the migration guides and breaking change documentation, and removes the obsolete
AllFeaturessample. The changes also update sample usage to use the new builder and extension method patterns, and introduce new helper methods for entity access.Refactoring and consolidation of activity entity extension methods:
ActivityQuotedReplyExtensions.csandActivityTargetedMessageInfoExtensions.cs, moving their logic into more appropriately named and organized extension classes (such asMentionEntityExtensions,CitationEntityExtensions, etc.), and updated usages throughout the codebase. [1] [2] [3] [4]GetMentions,GetQuotedMessages,GetCitation, etc.) and updated documentation to reflect these changes. [1] [2]Sample and usage updates:
Quoting,TeamsBot) to use the new builder pattern and extension methods for adding quotes and citations, replacing old direct usage of message entities. [1] [2] [3] [4]AllFeaturessample project and its related files. [1] [2] [3] [4]Documentation improvements:
Project and solution cleanup:
docs/Architecture.mdfile from the solution, likely as part of documentation consolidation.