Move IsTargeted property from Activity to Account#365
Conversation
ShanmathiMayuramKrithivasan
commented
Mar 10, 2026
- Moved IsTargeted from Activity to Account and made it serializable, so it's present in the JSON payload as Recipient.IsTargeted.
- Updated routing logic to read from Recipient.IsTargeted instead of Activity.IsTargeted
There was a problem hiding this comment.
Pull request overview
This PR relocates the “targeted activity” flag from Activity to Account so it can be serialized as recipient.isTargeted, and updates sending/routing behavior and tests accordingly.
Changes:
- Removed
Activity.IsTargetedand added nullableAccount.IsTargetedwith JSON serialization metadata. - Updated
WithRecipient(...)and ASP.NET Core sender plugin logic to useRecipient.IsTargetedfor targeted routing. - Updated/removed tests to validate the new property location and serialization behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Microsoft.Teams.Apps.Tests/AppTests.cs | Updates targeted message assertions to use Recipient.IsTargeted and removes obsolete validation test. |
| Tests/Microsoft.Teams.Api.Tests/Activities/Message/MessageActivityTests.cs | Updates fluent API and JSON serialization tests to assert recipient.isTargeted. |
| Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/AspNetCorePlugin.cs | Switches targeted routing detection to activity.Recipient?.IsTargeted == true. |
| Libraries/Microsoft.Teams.Apps/App.cs | Removes proactive-send validation that depended on Activity.IsTargeted. |
| Libraries/Microsoft.Teams.Api/Activities/Activity.cs | Removes IsTargeted, updates WithRecipient, and removes targeted merge behavior. |
| Libraries/Microsoft.Teams.Api/Account.cs | Adds IsTargeted as a serializable property on Account. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
Libraries/Microsoft.Teams.Api/Activities/Activity.cs:434
Activity.Mergepreviously propagated the targeted flag; after moving it ontoRecipient.IsTargeted, the merge no longer preserves that state whenRecipientis already set. To maintain the old behavior (targeted wins), mergefrom.Recipient?.IsTargeted==trueinto the currentRecipient(e.g., ifRecipientis not null, setRecipient.IsTargeted = truewhen the source is targeted).
public Activity Merge(Activity from)
{
Id ??= from.Id;
ReplyToId ??= from.ReplyToId;
ChannelId ??= from.ChannelId;
From ??= from.From;
Recipient ??= from.Recipient;
Conversation ??= from.Conversation;
RelatesTo ??= from.RelatesTo;
ServiceUrl ??= from.ServiceUrl;
Locale ??= from.Locale;
Timestamp ??= from.Timestamp;
LocalTimestamp ??= from.LocalTimestamp;
AddEntity(from.Entities?.ToArray() ?? []);
if (from.ChannelData is not null)
{
WithData(from.ChannelData);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.