Skip to content

Core/activity extensions#515

Merged
MehakBindra merged 9 commits into
mainfrom
core/activity-extensions
May 20, 2026
Merged

Core/activity extensions#515
MehakBindra merged 9 commits into
mainfrom
core/activity-extensions

Conversation

@MehakBindra
Copy link
Copy Markdown
Collaborator

@MehakBindra MehakBindra commented May 16, 2026

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 AllFeatures sample. 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:

  • Removed ActivityQuotedReplyExtensions.cs and ActivityTargetedMessageInfoExtensions.cs, moving their logic into more appropriately named and organized extension classes (such as MentionEntityExtensions, CitationEntityExtensions, etc.), and updated usages throughout the codebase. [1] [2] [3] [4]
  • Introduced new extension methods and helpers for accessing entities (e.g., GetMentions, GetQuotedMessages, GetCitation, etc.) and updated documentation to reflect these changes. [1] [2]

Sample and usage updates:

  • Updated all sample code (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]
  • Removed the obsolete AllFeatures sample project and its related files. [1] [2] [3] [4]

Documentation improvements:

  • Updated the migration guide and breaking changes documentation to clarify the new patterns for activity entity access and construction, including extension method availability and builder usage. [1] [2] [3]

Project and solution cleanup:

  • Removed the docs/Architecture.md file from the solution, likely as part of documentation consolidation.

@MehakBindra MehakBindra marked this pull request as ready for review May 16, 2026 00:58
Copilot AI review requested due to automatic review settings May 16, 2026 00:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MessageActivityExtensions with many fluent With*/Add* helpers and adjusts builder behavior around typed MessageActivity fields.
  • Updates unit tests, migration docs, and samples to reflect renamed/relocated APIs (e.g., WithQuoteAddQuote, 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.

Comment thread core/src/Microsoft.Teams.Apps/Schema/TeamsConversationAccount.cs Outdated
Comment thread core/src/Microsoft.Teams.Apps/Schema/TeamsConversation.cs Outdated
Comment thread core/src/Microsoft.Teams.Apps/Schema/MessageActivityExtensions.cs Outdated
Comment thread core/docs/MigrationGuide.md Outdated
Comment thread core/docs/ReduceBreakingChangesPlan.md Outdated
Comment thread core/src/Microsoft.Teams.Apps/Schema/TeamsChannelData.cs
Comment thread core/test/Microsoft.Teams.Apps.UnitTests/TeamsActivityTests.cs Outdated
@rido-min rido-min added the CORE label May 18, 2026
@MehakBindra MehakBindra requested review from rido-min and singhk97 May 19, 2026 00:32
@MehakBindra MehakBindra merged commit 1b83226 into main May 20, 2026
10 checks passed
@MehakBindra MehakBindra deleted the core/activity-extensions branch May 20, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants