Add support for shared channels to: teams channel member add#7133
Add support for shared channels to: teams channel member add#7133adamlonsdale wants to merge 3 commits intopnp:mainfrom
Conversation
Co-authored-by: adamlonsdale <2413779+adamlonsdale@users.noreply.github.com>
Fix `teams channel member add` validation to support shared channels
There was a problem hiding this comment.
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 |
| if (channelItem.membershipType !== 'private' && channelItem.membershipType !== 'shared') { | ||
| throw 'The specified channel is not a private or shared channel'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is a valid point @adamlonsdale. Could you have a look at the other commands as well?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Since the fix is not that large, I think we can do them in one PR.
|
I'll mark this PR as draft until the additional changes are in. |
Closes #7132