0
votes

I am working with Microsoft Bot Framework SDK v3, as well as v4, for node.js. I have one v3 bot & one v4 bot, both with MS teams channel, but I'm not able to get users' profile details in bot code for v4 bot. (exactly looking for userprincipalname )

In v3 I'm using TeamsChatConnector which has fetchMembers() which fetches users details, but things have changed in v4. It is also known as 'Fetching the team roster'. Here is the documentation

In the v4 bot, there is BotFrameworkAdapter which is not specific to MS teams or any other channel. If I inspect activity object, I can see from the 'from' property, it only has user's name:'lastName,First name' AND AAD object id, but not userprincipalname which is usually an email address.

How can I get access to users email address or userprincipalname in v4 BOT code if users is using MS teams channel?

  connector.fetchMembers(
    (<builder.IChatConnectorAddress>session.message.address).serviceUrl,
    conversationId,
    (err, result) => {
      if (err) {
        session.endDialog('There is some error');
      }
      else {
        session.endDialog('%s', JSON.stringify(result));
      }
    }
);
1
Did anyone get a chance to look for possible options for this ? - vijay
v3 to v4 is not as easy as it looks. I'm looking at it for you. - JJ_Wailes

1 Answers

0
votes

Leaving this here if somebody is as lost as me. You can make a request to the REST API, getting that information. Here you can see the endpoint

And here you can see how to set up the headers: Link

Combining both, making a GET will return context of the users in a team chat or 1:1 chat.