Forum Discussion

YvanB's avatar
YvanB
Copper Contributor
Oct 12, 2020

TeamId is not always filled in OnTeamsMembersAddedAsync

Hello,

 

I have developed a bot for teams.

 

When a user install the bot on one of his channels, I want to save information about the channel (the TeamId and the TenantId)

 

But when OnTeamsMembersAddedAsync is called, the teamId is not always filled. And when it is missing, I have no way to get it via other properties.

 

For now, it seems a little random. Sometimes when I install the bot, the TeamId is filled sometimes not.

 

Is there a better way to "catch" those information ?

Is this a known issue?

Am I doing somethig wrong or  ?

 

Thanks

 

  • YvanB 

    Could you please try to get information from "OnConversationUpdateActivityAsync" method.
    Please go through below document for reference.

    • YvanB's avatar
      YvanB
      Copper Contributor

      Rama-MSFT 

       

      Thanks for the answer,

       

      As there is several ways to get the teamId, I've implemented a method to get this information from the turnContext, teamInfo and the channelAccounts (I take the first non-null one).

       

      Also as the OnConversationUpdateActivityAsync is just taking some information from the turnContext and then call the OnTeamsMembersAddedAsync method, I'm not sure I will get more information from this method.

       

      I tried nonetheless and i've the same issue. The teamid is sometimes not in the turnContext

       

       

      • Rama-MSFT's avatar
        Rama-MSFT
        Icon for Microsoft rankMicrosoft

        YvanB 

         

        Firstly, we have to add our application in to channel, and please add any member to the team, now you you will hit the "OnTeamsMembersAddedAsync" method. Now you will receive the teamsid in the ChannelData.

         

        Could you please have a look on below sreenshot.