简体   繁体   English

如何在 MSTEAMS 上查看会员状态

[英]How check member status on MSTEAMS

For a purpose of checking member status (online or offline) on MSTeams, I want to get member status by email.为了在 MSTeams 上检查成员状态(在线或离线),我想通过电子邮件获取成员状态。

I have approached Bot Builder Microsoft Teams Extensions and write a sample code to get into my idea:我已经接触了Bot Builder Microsoft Teams Extensions并编写了一个示例代码来表达我的想法:

var teams = require("botbuilder-teams");

bot.dialog('FetchMemberInfo', function (session) {
    var memberEmail = 'billzeng@csc.com';

    var connector = new teams.TeamsChatConnector({
        appId: process.env.MICROSOFT_APP_ID,
        appPassword: process.env.MICROSOFT_APP_PASSWORD
    });

    connector.fetchMemberInfo(session.message.address.serviceUrl, memberEmail, function (err, result) {
        if (err) {
            session.endDialog('There is some error');
        }
        else {
            var memberStatus = result.member.status;
            session.endDialog('%s', JSON.stringify(result));
        }
    });
});

I only have member's email and want to get member status.我只有会员的电子邮件,想获得会员状态。 So, what place in my sample code need to be updated to get member information which include member status?那么,我的示例代码中的哪些地方需要更新以获取包括会员状态在内的会员信息? I also welcome any other suggestion if there is.如果有的话,我也欢迎任何其他建议。

APIs to get/set user's presence status is not available yet.用于获取/设置用户在线状态的 API 尚不可用。 It's on the API roadmap but it's not possible as of today它在 API 路线图上,但在今天是不可能的

Actually, we can get user status (online/offline) via Skype4Business API.实际上,我们可以通过 Skype4Business API 获取用户状态(在线/离线)。 Here is an example code:这是一个示例代码:

var authContext = {
    id: botSetting.identifier,
    username: botSetting.username,
    password: botSetting.password,
    domain: botSetting.domain,
    _links: {},
    /*1 seconds*/
    messageInterval: 1000 * botSetting.messageInterval,
    /*30 seconds*/
    messageTimeout: 1000 * botSetting.messageTimeout,
    /*3 minutes, unit in second*/
    statusUpdateInterval: 1000 * botSetting.statusUpdateInterval,
    AppId: null,
    AppPath: null,
    EndPointId: botSetting.endpointId,
    Culture: botSetting.culture,
    UserAgent: botSetting.userAgent,
    /* default timeout to wait for user to accept message is 5 minutes */
    acceptMessageInvitationTimeout: botSetting.acceptMessageInvitationTimeout * 1000,
    logUnhandleEvent: botSetting.logUnhandleEvent,
    RootAppUrl: null,
    /*default is 30 seconds, unit in second*/
    statusAwarenessInterval: (CONFIG.PROACTIVE_MESSAGE_INTERVAL_IN_SECONDS || 30) * SECOND_TO_MILLISECONDS, //30 seconds
    remindProcessProactiveMsgInterval: 1000 * 60 * CONFIG.PROACTIVE_MESSAGE_REMIND_IN_MINUTES,
    proactive_interval: process.env.PROACTIVE_UPDATE_INTERVAL_IN_MINUTES || 2
};
    
function getUserAvailibility(receiver){
    var url = authContext._embedded.people._links.self.href;
    var requestResourceUrl = stringFormat("{0}{1}/{2}/presence", authContext.BaseUri, 
                                           url, receiver);
    console.log("SkypeForBusinessBot getUserAvailibility " + receiver +
                " with url: " + requestResourceUrl);
    return $q.nfcall(request.get, requestResourceUrl, {
        headers: authContext.headers, json: true });
    }

Note: receiver is user's email注意:接收者是用户的电子邮件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM