如何获取Microsoft Teams上下文属性hostClientType

时间:2018-08-10 13:36:53

标签: microsoft-teams

我一直在尝试从Teams上下文获取hostClientType。我得到以下代码的上下文,但是hostClientType未填充/不可用。我需要区分在团队Webapp或团队桌面应用程序中运行,因此认为该属性是。任何帮助表示赞赏。

microsoftTeams.getContext(function (context) {
  alert(context.hostClientType) // undefined
})

1 个答案:

答案 0 :(得分:0)

.getContext返回的不在对象中。

尝试使用navigator.userAgent-它会返回类似"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Teams/1.1.00.22163 Chrome/61.0.3163.100 Electron/2.0.4 Safari/537.36"的内容。