Adds command: teams deeplink tab generate#1722
Adds command: teams deeplink tab generate#1722nanddeepn wants to merge 8 commits intopnp:masterfrom nanddeepn:deeplink
Conversation
| `-l, --label <label>`|The label to use in the deep link | ||
| `-m, --tabType <TabTypeOptions>`|The tab type. Allowed values `Static`, `Configurable` | ||
| `--query [query]`|JMESPath query string. See [http://jmespath.org/](http://jmespath.org/) for more information and examples | ||
| `-o, --output [output]`|Output type. `json|text`. Default `text` |
There was a problem hiding this comment.
Escaped pipe json|text should be replaced with comma json,text
|
Hey @nanddeepn , thank you so much for this. Looks like the test coverage has dropped, could you please take a look? Feel free to reach out if you have any questions 🙂 |
|
Hi @rabwill |
|
Hey @nanddeepn , looks like you need to add one more test with debug option From this report looks like we have 2 things to take care of
Also when you do an If you still have any question please drop us a line, and thank you so much again for sparing your time 👍🏽 |
|
Thank you @nanddeepn we will review shortly 👍🏻 |
garrytrinder
left a comment
There was a problem hiding this comment.
Thanks @nanddeepn please see my comments in the review.
I've also been having some issues testing this in my tenant, entityId seems to be always returning as null when targeting either out of the box Tabs, like Website and also Custom Tabs from a Custom Teams App.
If you could give any guidance on how you have been testing in your tenant that would be great for me to follow along.
| `--verbose`|Runs command with verbose logging | ||
| `--debug`|Runs command with debug logging | ||
|
|
||
| ## Examples |
There was a problem hiding this comment.
The example here does not match the example in the command help
There was a problem hiding this comment.
Sorry @garrytrinder ,
Did not get this point. Can you please clarify the command mismatch?
| ## Examples | ||
|
|
||
| Generates a Microsoft Teams deep link from an existing Tab with id 1432c9da-8b9c-4602-9248-e0800f3e3f07 | ||
|
|
There was a problem hiding this comment.
Let's remove this unnecessary empty line
|
|
||
|
|
||
| Get deeplink for tab with id, for a configurable tab | ||
| ```sh |
There was a problem hiding this comment.
We should add an empty line here to separate the example text and the example
| ``` | ||
|
|
||
| Get deeplink for tab with id, for a static tab | ||
| ```sh |
There was a problem hiding this comment.
We should add an empty line here to separate the example text and the example
| `-c, --channelId <channelId>`|The ID of the channel where the tab exists | ||
| `-t, --tabId <tabId>`|The ID of the tab to generate the deep link from | ||
| `-l, --label <label>`|The label to use in the deep link | ||
| `-m, --tabType <TabTypeOptions>`|The tab type. Allowed values `Static`, `Configurable` |
There was a problem hiding this comment.
Lets change <TabTypeOptions> to <tabTypeOptions>, note the lowercase leading character
| let context: string = `{"channelId": "${args.options.channelId}"}`; | ||
| deeplink = { deeplink: `https://teams.microsoft.com/l/entity/${appId}/${entityId}?webUrl=${contentUrl}&label=${args.options.label}&context=${context}` }; |
There was a problem hiding this comment.
As context variable includes special characters or spaces, and will be used in a URL, we should encode the value.
|
|
||
| You can only retrieve deeplink to tabs for teams of which you are a member. | ||
|
|
||
| Tabs 'Conversations' and 'Files' are present in every team and therefore not |
There was a problem hiding this comment.
The docs and command help should match.
| 'teams user remove', | ||
| 'teams user set' | ||
| 'teams user set', | ||
| 'teams deeplink tab generate' |
There was a problem hiding this comment.
As this command does not implement an alias we should remove this line.
| tabType: string; | ||
| } | ||
|
|
||
| class TeamsDeeplinkTabGenerateCommand extends GraphCommand { |
There was a problem hiding this comment.
We should implement the getTelemetryProperties method to provide command telemetry.
| { | ||
| option: '-m, --tabType <TabTypeOptions>', | ||
| description: `The tab type. Allowed values ${this.tabTypeMap.join('|')}. Default ${this.tabTypeMap[0]}`, | ||
| autocomplete: this.tabTypeMap |
There was a problem hiding this comment.
As we only have two possible values for this option and they are not likely to change, we can just use a string array here to keep things simple and easier to read, as we have done with other commands.
See example here in cdn-policy-set.ts
Hi @garrytrinder |
Hi @garrytrinder Can we use the webUrl property instead? |
If |
Thanks! We should always get the |
|
Hi @garrytrinder |
|
Hey @nanddeepn thank you for making the changes, when you are happy for your PR to be reviewed after making changes, please use the “Ready for Review” button to take it out of “Draft” status, that way we know that it is ready to review. I have done this for you on this PR 👍🏻 |
|
Thank you for making the changes @nanddeepn however I am still having issues testing this, please see the behaviour seen below. I added a SharePoint Tab to a Teams Channel and executed the command with the following options
which generates the below URL
Using this in a link takes me to this page and not the tab in the Team If I go to the tab and copy the link from the menu It generates the below URL
Which when pasted into a chat, takes me to the correct location. Oddly when pasted into a chat, the Tab name is displayed as the link Label even though it is not present in the generated URL, so the UI must be doing something we can't see, however looking at the {
"subEntityId": null,
"channelId": "19:[email protected]"
}Based on the above, it would appear that the command implementation is much simpler than first imagined and that we can simply return the
The documentation that I refer to in the original Issue seems to be related to deep linking to a Tab within a Teams Personal App and not to a Tab within a Team Channel like this command is attempting to do. I would suggest that we remove the @pnp/cli-for-microsoft-365-maintainers thoughts? |
|
In order to generate the URL to tab, i.e. of type
Because the default tabType is
Please let me know, if I misunderstood your queries. |
|
@nanddeepn just for my understanding: is the |
|
Hi @waldekmastykarz Each Format of deeplink for |
|
Do both of these generated links work and take you to the tab? If so, what's the difference between them? |
|
Here is the output Deeplink for Configurable tabType Below is the generated deeplink URL: Deeplink for Static tabType Below is the generated deeplink URL: |
|
So if I understand it correctly, the one takes you to the instance of the tab in a channel, where the other to its definition? In that case, I think we should rename the |
|
Just to make you aware that I changed the spec slightly on the associated issue following @waldekmastykarz comments. I will make some time to take look through this PR later this evening following your comments @nanddeepn, thank you for providing the detail 👍🏻 |
|
At the moment, I don't see what value the I have the following Tabs configured in a Teams channel, I have returned the Copy Link (generated using the UI button) and Web Url (taken from the MS Graph Tab response) to see the difference.
Using either the Copy Link or Web Url has the desired effect, clicking the link opens the Tab in the Channel. Looking at the documentation, https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links, there is the below note
As the To me that changes the behaviour of the command and that rather than generating a deep link we are just returning a specific property of the Tab response. Rather than having a command that is specific, |
|
If we can get the url using 'teams tab get' then it would have my preference because we'd be getting the URL directly from the service rather than trying to generate it ourselves. |
|
Hi @waldekmastykarz, @garrytrinder |
|
@garrytrinder what's the best way forward: update the existing spec or shall we close this PR, close the related issue and create a whole new issue? Sorry for the trouble @nanddeepn and appreciate you sticking with us 😊 |
Happy to help, anytime 😊 |
I think it would be best to close the PR and related issue. I'll raise a new issue with the Apologies for the trouble on this @nanddeepn, really appreciate your patience on this one 👍🏻 |
|
@nanddeepn I have raised the new issue for |






Closes #1656