Cli-microsoft365: New command: Add a tab in a channel in a Microsoft Teams team

Created on 4 Mar 2019  路  10Comments  路  Source: pnp/cli-microsoft365

Usage

teams tab add [options]

Description

Add a tab to the specified channel

Options

| Option | Description |
| ----------------------- | ----------------------------------------- |
| -i, --teamId <teamId> | The ID of the team to where the channel exists |
| -c, --channelId <channelId> | The ID of the channel to add a tab to |
| --appId <appId> | The ID of the Teams app that contains the Tab |
| --appName <appName> | The name of the Teams app that contains the Tab |
| --entityId [entityId] | A unique identifier for the Tab |
| --contentUrl <contentUrl>| The URL used for rendering Tab contents |
| --removeUrl [removeUrl] | The URL displayed when a Tab is removed |
| --websiteUrl [websiteUrl] | The URL for showing tab contents outside of Teams |

Additional Information

This command should allow using unknown properties. Each property corresponds to additional configuration that should be set when adding the tab. Standard properties should be excluded from request.

The corresponding app must already be installed in the team.

entityId, removeUrl & websiteUrl option values should be sent as null if not provided

Add tab to channel - https://docs.microsoft.com/en-us/graph/api/teamstab-add?view=graph-rest-1.0

teamsTabConfiguration resource type (Open Type) - https://docs.microsoft.com/en-us/graph/api/resources/teamstabconfiguration?view=graph-rest-1.0

Configuring the built-in tab types in Microsoft Teams - https://docs.microsoft.com/en-us/graph/teams-configuring-builtin-tabs

good first issue new feature work in progress

Most helpful comment

Is this free to pick up, would like to learn about this unknown option seems interesting :) thank you.

All 10 comments

Nice feature request and spec. I've updated the formatting so that it's easier to read. With regards to the tab's body, would it make sense to accept the full JSON blob as a string or shall we break it down to specific properties and construct the blob behind the scenes ourselves?

@wictorwilen @vman @estruyf what do you think?

Nice one, I was going to suggest this next but @NWessel beat me to it :)

This API is already available in v1.0 of the Graph so we could use that one instead of the beta endpoint.
https://docs.microsoft.com/en-us/graph/api/teamstab-add?view=graph-rest-1.0

Also, +1 to specifying properties as options to the command (similar to how it works for other commands)

Is the tabs JSON fixed or would we have to support all properties and somehow deal with the nested properties under configuration?

So turns out the configuration object can contain custom properties depending upon the tab itself:
https://docs.microsoft.com/en-us/graph/api/resources/teamstabconfiguration?view=graph-rest-1.0

So the custom properties could be json/string and we might have to go with something like:
graph teams tab add --teamId --channelId --appId --appName --config <config>

What if we'd allow specifying custom options like we do in for example spo listitem add (https://github.com/pnp/office365-cli/blob/master/src/o365/spo/commands/listitem/listitem-add.ts#L40-L42, https://github.com/pnp/office365-cli/blob/master/src/o365/spo/commands/listitem/listitem-add.ts#L392)? That way we'd simply specifying the properties and not have users have to deal with escaping the JSON string.

Would it be possible to allow for different ways of doing it?
Personally i prefer to build the entire JSON object myself and then just apply that instead of doing it in bits. I feel like it gives more control and transparency

That's definitely an option! So we could allow passing the whole JSON string or break it up in separate properties.

Updated OP to use new command template and updated the spec following discussions.

The spec now incorporates the setting of additional configuration settings (highlighted by @vman) through options like we have implemented for spo listitem add (highlighted by @waldekmastykarz) to keep some consistency between commands and provide a nice API for the end users which is more familiar.

The four configuration options that are required to be sent in the payload are explicitly named, this will make it much easier for users to set the configuration required for adding built-in tab types. Any options provided after these will be deemed as additional configuration for use in custom tabs.

Whilst setting the configuration via JSON alone is a nice feature, let's make that an enhancement to the base command should there be interest in doing so.

Is this free to pick up, would like to learn about this unknown option seems interesting :) thank you.

It certainly is @rabwill all yours now 馃憤馃徎

Was this page helpful?
0 / 5 - 0 ratings

Related issues

waldekmastykarz picture waldekmastykarz  路  3Comments

vineet2907 picture vineet2907  路  3Comments

VelinGeorgiev picture VelinGeorgiev  路  3Comments

plamber picture plamber  路  3Comments

waldekmastykarz picture waldekmastykarz  路  3Comments