Skip to content

Add support for shared channels to: teams channel member add#7133

Draft
adamlonsdale wants to merge 3 commits intopnp:mainfrom
adamlonsdale:main
Draft

Add support for shared channels to: teams channel member add#7133
adamlonsdale wants to merge 3 commits intopnp:mainfrom
adamlonsdale:main

Conversation

@adamlonsdale
Copy link

Closes #7132

Copilot AI and others added 3 commits February 16, 2026 22:49
Co-authored-by: adamlonsdale <2413779+adamlonsdale@users.noreply.github.com>
Fix `teams channel member add` validation to support shared channels
Copy link

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 adds support for shared channels to the teams channel member add command, fixing issue #7132 where users could not add members to shared channels despite the Microsoft Graph API supporting this functionality.

Changes:

  • Updated validation logic to accept both 'private' and 'shared' channel membership types
  • Updated error messages to reflect support for both channel types
  • Added comprehensive test coverage for shared channel scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/m365/teams/commands/channel/channel-member-add.ts Modified validation logic to accept both 'private' and 'shared' channels, updated error message accordingly
src/m365/teams/commands/channel/channel-member-add.spec.ts Added test data for shared channels, added test case for adding members to shared channels, updated test descriptions and error message expectations

Comment on lines +183 to +184
if (channelItem.membershipType !== 'private' && channelItem.membershipType !== 'shared') {
throw 'The specified channel is not a private or shared channel';
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

While this fix correctly adds support for shared channels to teams channel member add, there are related commands teams channel member remove (src/m365/teams/commands/channel/channel-member-remove.ts:210-211) and teams channel member set (src/m365/teams/commands/channel/channel-member-set.ts:193-194) that have the same limitation. Their descriptions already mention "private or shared team channel" but their validation logic still only accepts private channels. Consider updating those commands as well to maintain consistency and ensure all channel member management commands fully support shared channels.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@milanholemans milanholemans Feb 17, 2026

Choose a reason for hiding this comment

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

This is a valid point @adamlonsdale. Could you have a look at the other commands as well?

Copy link
Author

Choose a reason for hiding this comment

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

This is a fair point, I was weighing up the tradeoff between multiple commits / PRs vs this one. I'll add these now, test and push an update

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the fix is not that large, I think we can do them in one PR.

@milanholemans
Copy link
Contributor

I'll mark this PR as draft until the additional changes are in.

@milanholemans milanholemans marked this pull request as draft February 17, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug report: teams channel member add doesn't support shared channels

4 participants