Cli-microsoft365: New command: teams conversationmember add

Created on 24 Oct 2020  路  9Comments  路  Source: pnp/cli-microsoft365

Usage

teams conversationmember add [options]

Alias

teams conversationmenber set [options]

Description

Adds or sets a conversationmember in a private channel

Options

| Option | Description |
| ----------------------- | ----------------------------------------- |
| --teamId [teamId] | The Team's ID. Specify either the teamName or teamId |
| --teamName [teamName] | The Team's displayname. The Team's ID. Specify either the teamName or teamId |
| --channelId [channelId] | The private channel's ID. Specify either the channelName or channelId |
| --channelName [channelName] | The private channel's name. Specify either the channelName or channelId |
| --userId [userId] | The user's ID or userprincipalname. You can also pass a comma separated list of userIds |
| --userDisplayName [userDisplayName] | The displayName of a user. You can also pass a comma separated list of displaynames. |
| --owner | Assign the user the owner role. Defaults to member permissions |

Note

  • At least one owner must be assigned to a private channel.
  • You can only add members and owners of a Team to a private channel.

Additional Information

https://docs.microsoft.com/en-us/graph/api/team-post-members?view=graph-rest-1.0&tabs=http

help wanted new feature

Most helpful comment

I can, but it will have to wait to next week!

Please assign me!

All 9 comments

Looking at the spec, let's allow referring to team, channel and user by their name as well to make it easier to use.

@waldekmastykarz as in #1880 and #1879

I am not sure about the DisplayName of the Team. Is not unique and therefore not super appropriate I believe. Channel name can be considered because it is unique.

Not sure about the DisplayName of the user. I think the userprincipalname is more safe. Do we have other examples regarding this?

What came to my mind is that you can pass multiple userIds as an array. I can also perform the operation oneshot.

In a real world scenario this would mean that I have to run two commands if I want to set the owners and members of a team

teams conversationmembers add --teamId [teamId] --channelId [channelId] --userId [111, 112, 113, 114] --owner
teams conversationmembers add --teamId [teamId] --channelId [channelId] --userId [555, 556, 557]

This would add 3 members and two 4 owners to the private channel.

Updated command name to singular to match our naming convention.

I am not sure about the DisplayName of the Team. Is not unique and therefore not super appropriate I believe. Channel name can be considered because it is unique.

See remark on #1880

Not sure about the DisplayName of the user. I think the userprincipalname is more safe. Do we have other examples regarding this?

Good point. I don't think we have a sample with UPN, but it makes sense to use it over the display name

What came to my mind is that you can pass multiple userIds as an array. I can also perform the operation oneshot.

I don't think you can pass an array as an argument in bash. The most we can do is a comma-separated string which we then break up into an array. It absolutely makes sense to allow the ability to pass multiple users

Hi @sebastienlevert,
is this a command that you would like to pick up? It is using the endpoints you already used in the conversationlist commands.

An important difference here is that you can only execute the operation on private channels only.

Thank you for your feedback.

br,
Patrick

I can, but it will have to wait to next week!

Please assign me!

@sebastienlevert Thank you. Highly appreciated

Just wanted to check in on this one. Still on my table, but looking for more cycles. If someone want it, feel free to raise you hands. If not, I'll keep it and come to it somewhere before the end of this year! Sorry about it!

No need to be sorry. Life happens, especially around switching jobs 馃榿 Shall we set it as open for grabs and if it's still available when you have time, you can take it back. Deal?

Deal!

Was this page helpful?
0 / 5 - 0 ratings