Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance teams chat list command to list chats for a specific user #3774

Closed
KbWorks opened this issue Oct 8, 2022 · 11 comments
Closed

Enhance teams chat list command to list chats for a specific user #3774

KbWorks opened this issue Oct 8, 2022 · 11 comments
Assignees
Milestone

Comments

@KbWorks
Copy link
Contributor

KbWorks commented Oct 8, 2022

New specs

Based on the comments, the following specs emerged:

Enhance the teams chat list command to be able to query a list of chats for a specified user. (Using app only permissions)

Option Description
--userId [userId] The Id of the user for which to list chats. Specify either userName or userId but not both.
--userName [userName] The upn of the user for which to list chats. Specify either userName or userId but not both.

Requested Specs for reference

Usage

m365 teams user chat list

Description

Get all chats of a user using apponly credentials

Options

Options would be
-query or-filter
-type oneOnOne, group, meeting
-top

Examples

m365 teams user chat list userprincipalmail of id.

Additional Info

No response

@milanholemans
Copy link
Contributor

Hi @KbWorks thank you for your suggestion.
So if I understand it correctly you want a command to list all teams chats for a current user right?
Something like this:
https://learn.microsoft.com/en-us/graph/api/chat-list

@milanholemans
Copy link
Contributor

@KbWorks could you give us some more info?

@martinlingstuyl
Copy link
Contributor

We do have a command for listing chats: https://pnp.github.io/cli-microsoft365/cmd/teams/chat/chat-list/

It would be better to update that one with the possibility to call it with app only credentials.

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Dec 10, 2022

It would be better to update that one with the possibility to call it with app only credentials.

@martinlingstuyl what would be needed to support app-only in the existing command?

@martinlingstuyl
Copy link
Contributor

@waldekmastykarz

The chat list command currently uses the /chats endpoint. There is another variant of the endpoint. We would need to allow passing in a userId as an option.

GET /me/chats
GET /users/{user-id | user-principal-name}/chats

More info: https://learn.microsoft.com/en-us/graph/api/chat-list?view=graph-rest-1.0&tabs=http

@martinlingstuyl
Copy link
Contributor

What about:

Option Description
--user The upn or Id of the user for which to list chats. Defaults to the current user if not specified.

@waldekmastykarz
Copy link
Member

To simplify validation and be consistent with other commands, I suggest we split it into --userId and --userName.

@martinlingstuyl martinlingstuyl changed the title m365 teams user chat list Enhance teams chat list command to list chats for a specific user Dec 10, 2022
@martinlingstuyl
Copy link
Contributor

Based on the discussion, I updated the specs @KbWorks.

@waldekmastykarz
Copy link
Member

Looks good. Let's open it up.

@MathijsVerbeeck
Copy link
Contributor

I could work on this one

@milanholemans
Copy link
Contributor

Cool, all yours @MathijsVerbeeck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants