Would it be possible to get TeamsChannelAccount instance by querying user email address somehow?

Copper Contributor

Hello,

 

I guess we could get all users info by using TeamsInfo.GetPagedMembersAsync... I believe it should list all members.... then is there any method that I can use to search based on user email address to get the TeamsChannelAccount instance?

 

I mean..say one user(myuser1234@mycompany.com)  is a member...I guess we can use TeamsInfo.GetPagedMembersAsync then iterate every objects to compare each one to math Email property with myuser1234@mycompany.com .. Then isn't it too slow? 

 

I noticed TeamsInfo.GetMemberAsync..however, it accepts user id as a form of unique id like "28:.blahblah"...,...in that parameters.....So is there any method something like maybe...Teamsinfo.GetMemberByEmailAsync(context, "myuser1234@mycompany.com",cancellationToken)?? So I can easily look up with the specific user email address to obtain the TeamsChannelAccount instance for that account?

 

Thanks,

 

3 Replies

Hi @firstteam, Could you please test in graph, user must be in same domain. 

OK. I will...BTW, what about Bot instead of graph then? so I believe there is no such thing in Bot then. Correct?

Hi @firstteam,  currently its not possible to get TeamsChannelAccount instance 

using user email id. Instead we can try graph API (GET https://graph.microsoft.com/v1.0/users/userPrincipalName) to get user id using email address.