在个人 msteams 应用程序中的选项卡之间手动切换

Switching manually between tabs in personal msteams application

我的个人 msteams 应用程序中有两个选项卡,我想在它们之间动态导航。可能吗?我尝试使用 msteams SDK 中的 microsoftTeams.getTabInstances 方法来获取我的选项卡,然后通过调用 microsoftTeams.navigateToTab 导航到所选选项卡,但这种方法不起作用 - 我从 microsoftTeams.getTabInstances.我的用户已登录(我在某处读到用户必须登录)。

我还没有完全尝试过这个动作,但我相信你应该能够使用 Deep Links. In particular, see the Deep linking from your tab 来做你正在尝试的事情,它谈到了

This is useful if your tab needs to link to [...] another tab [...]

语法是

microsoftTeams.executeDeepLink(/*deepLink*/);

提醒一下,在深层 link 语法中,例如https://teams.microsoft.com/l/entity/<appId>/<entityId>,appid 是您的 Teams 应用 ID,"entityId" 必须与 Teams 清单文件中选项卡的 "entityId" 匹配。

您可以从您的选项卡深入link Teams 中的内容。如果您的选项卡需要 link 到 Teams 中的其他内容(例如频道、消息、另一个选项卡,甚至打开计划对话框),这将非常有用。要从您的选项卡触发深度link,您应该调用:

   var encodedWebUrl = encodeURI('https://tasklist.example.com/123/456&label=Task 456');
var encodedContext = encodeURI('{"subEntityId": "task456"}');
var taskItemUrl = 'https://teams.microsoft.com/l/entity/fe4a8eba-2a31-4737-8e33-e5fae6fee194/tasklist123?webUrl=' + encodedWebUrl + '&context=' + encodedContext;

请看一下Deep Link to your tab