New command graph teams tab list solving #849#896
Conversation
New command graph teams tab list
|
Hero! We're going to review it asap. Thank you! 👏 |
VelinGeorgiev
left a comment
There was a problem hiding this comment.
Hey @thomyg, great first commit! Worked like charm! I did few minor changes before we can merge it. You can find my inline comments.
You can see the changes I made here: https://github.com/VelinGeorgiev/office365-cli/tree/thomy/master. Waldek will use that branch to merge it with the pnp one.
Two additional things:
- When you do
npm install, thenpm-shrinkwrap.jsonfile get changed. I usually do not include the changed file in the pull request and let Waldek make changes to thenpm-shrinkwrap.jsonwhen needed. - I've added the
teams-tab-list.mddoc to themkdocs.yamlfile under the teams nodes. That is required as part of the pull request.
| } | ||
|
|
||
| public get description(): string { | ||
| return 'Lists Tabs in a Microsoft Teams team.'; |
There was a problem hiding this comment.
Changed to Lists tabs in the specified Microsoft Teams channel
| const options: CommandOption[] = [ | ||
| { | ||
| option: '-i, --teamId <teamId>', | ||
| description: 'The ID of the team to list the tab of' |
There was a problem hiding this comment.
Changed to The ID of the team of the specific channel
| }, | ||
| { | ||
| option: '-c, --channelId <channelId>', | ||
| description: 'The ID of the channel to list the tab of' |
There was a problem hiding this comment.
Changed to The ID of the channel for which to list tabs
|
|
||
| To list the tabs in a Microsoft Teams channel, you have to first log in to the Microsoft Graph using the [graph login](../login.md) command, eg. `graph login`. | ||
|
|
||
| ## Examples |
There was a problem hiding this comment.
Example removed since not part of this command
| !!! important | ||
| Before using this command, log in to the Microsoft Graph, using the [graph login](../login.md) command | ||
|
|
||
| ## Remarks |
There was a problem hiding this comment.
Remarks removed since it duplicates with another one bellow
| } | ||
|
|
||
| interface Options extends GlobalOptions { | ||
| joined?: boolean; |
There was a problem hiding this comment.
joined removed since it is not part of the command specification.
| return 'Lists Tabs in a Microsoft Teams team.'; | ||
| } | ||
|
|
||
| public getTelemetryProperties(args: CommandArgs): any { |
There was a problem hiding this comment.
getTelemetryProperties is removed since the command has two mandatory options teamId and channelId and they are tracked by default. We use the getTelemetryProperties method in a case of optional options.
|
|
||
| public commandAction(cmd: CommandInstance, args: CommandArgs, cb: () => void): void { | ||
|
|
||
| let endpoint: string = `${auth.service.resource}/V1.0/teams/${args.options.teamId}/channels/${args.options.channelId}/tabs?$expand=teamsApp`; |
There was a problem hiding this comment.
encodeURIComponent(args.options.channelId) instead of just args.options.channelId just to ensure no weird characters in the id can break the request.
Also V1.0 changed to v1.0.
| List all tabs in a Microsoft Teams team | ||
| ${chalk.grey(config.delimiter)} ${this.name} --teamId <teamId> --channelId <channelId> | ||
|
|
||
| Include the all the values from the tab configuration and associated teams app |
There was a problem hiding this comment.
Changed to Include all the values from the tab configuration and associated teams app to remove one unnecessary the and match the description in the MD file.
|
|
||
| You can only see the tab list of a team you are a member of. | ||
|
|
||
| The tabs Conversations and Files are present in every team and therefor not provided as a |
There was a problem hiding this comment.
Typo. therefor changed to therefore.
|
thx @VelinGeorgiev for your feedback! appreciated! Sorry for not adding the documentation in the yaml file, that is stated in the help an I missed it, sorry. All the other remarks will be taken into account for future commits, THX! One more question, maybe not 100% only related to this PR, but I reached out to the Teams PG and the one responsible for the graph APIs and asked about how one could validate the channel ID. His answer basically was that he would only check for a "19:" on the begin of the string and the "@thread.skype.com" at the end. Everything else in between, that looks like a GUID without hyphens might change in the future. Details can be found in an NDA Teams team, so maybe ping me in private if you are interested. |
|
@thomyg good suggestion! We shouldn't create a separate utils class for Teams but instead add it to the existing Utils class. Feel free to create a new issue for this improvement so that we can track it separately. We can then decide if you want to pick it up yourself or let others do it 👏 |
|
Merged manually. Thank you! 👏 |
|
Good stuff! I am not very concerned about strict validation on the channel id, because the request will fail when the one using the CLI has entered wrong input. However, I also agree that will be better experience if we provide more meaningful message if the garph apis do not. |
Added new command for listing tabs in a Microsoft Teams channel.
Added:
Any feedback welcome! thx!