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

%3CLINGO-SUB%20id%3D%22lingo-sub-2349709%22%20slang%3D%22en-US%22%3EWould%20it%20be%20possible%20to%20get%20TeamsChannelAccount%20instance%20by%20querying%20user%20email%20address%20somehow%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2349709%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20guess%20we%20could%20get%20all%20users%20info%20by%20using%26nbsp%3BTeamsInfo.GetPagedMembersAsync...%20I%20believe%20it%20should%20list%20all%20members....%20then%20is%20there%20any%20method%20that%20I%20can%20use%20to%20search%20based%20on%20user%20email%20address%20to%20get%20the%20TeamsChannelAccount%20instance%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3EI%20mean..say%20one%20user(%3CA%20href%3D%22mailto%3Amyuser1234%40mycompany.com)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Emyuser1234%40mycompany.com)%3C%2FA%3E%26nbsp%3B%20is%20a%20member...I%20guess%20we%20can%20use%26nbsp%3BTeamsInfo.GetPagedMembersAsync%20then%20iterate%20every%20objects%20to%20compare%20each%20one%20to%20math%20Email%20property%20with%20%3CA%20href%3D%22mailto%3Amyuser1234%40mycompany.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Emyuser1234%40mycompany.com%3C%2FA%3E%26nbsp%3B..%20Then%20isn't%20it%20too%20slow%3F%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3EI%20noticed%26nbsp%3BTeamsInfo.GetMemberAsync..however%2C%20it%20accepts%20user%20id%20as%20a%20form%20of%20unique%20id%20like%20%2228%3A.blahblah%22...%2C...in%20that%20parameters.....So%20is%20there%20any%20method%20something%20like%20maybe...Teamsinfo.GetMemberByEmailAsync(context%2C%20%22myuser1234%40mycompany.com%22%2CcancellationToken)%3F%3F%20So%20I%20can%20easily%20look%20up%20with%20the%20specific%20user%20email%20address%20to%20obtain%20the%20TeamsChannelAccount%20instance%20for%20that%20account%3F%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3EThanks%2C%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2349709%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2370652%22%20slang%3D%22en-US%22%3ERe%3A%20Would%20it%20be%20possible%20to%20get%20TeamsChannelAccount%20instance%20by%20querying%20user%20email%20address%20somehow%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2370652%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1050314%22%20target%3D%22_blank%22%3E%40firstteam%3C%2FA%3E%2C%20Could%20you%20please%20test%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fusers%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Egraph%3C%2FA%3E%2C%20user%20must%20be%20in%20same%20domain.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2371475%22%20slang%3D%22en-US%22%3ERe%3A%20Would%20it%20be%20possible%20to%20get%20TeamsChannelAccount%20instance%20by%20querying%20user%20email%20address%20somehow%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2371475%22%20slang%3D%22en-US%22%3EOK.%20I%20will...BTW%2C%20what%20about%20Bot%20instead%20of%20graph%20then%3F%20so%20I%20believe%20there%20is%20no%20such%20thing%20in%20Bot%20then.%20Correct%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2380426%22%20slang%3D%22en-US%22%3ERe%3A%20Would%20it%20be%20possible%20to%20get%20TeamsChannelAccount%20instance%20by%20querying%20user%20email%20address%20somehow%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2380426%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1050314%22%20target%3D%22_blank%22%3E%40firstteam%3C%2FA%3E%2C%26nbsp%3B%20currently%20its%20not%20possible%20to%20get%26nbsp%3B%3CSPAN%20class%3D%22lia-message-read%22%3E%3CA%20id%3D%22link_2%22%20class%3D%22page-link%20lia-link-navigation%20lia-custom-event%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fteams-developer%2Fwould-it-be-possible-to-get-teamschannelaccount-instance-by%2Fm-p%2F2349709%22%20target%3D%22_blank%22%3ETeamsChannelAccount%20instance%26nbsp%3B%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eusing%20user%20email%20id.%20Instead%20we%20can%20try%20graph%20API%20(%3CSPAN%3EGET%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2FuserPrincipalName%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2FuserPrincipalName%3C%2FA%3E%3C%2FSPAN%3E)%20to%20get%20user%20id%20using%20email%20address.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.