Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

ActiveDirectoryClient IsMemberOfAsync cannot get result

$
0
0

Hi,


I got a problem when I use ActiveDirectoryClient.IsMemberOfAsync method to check if a user in the group. The method cannot get the result, and I didn't get any error. I use fiddler captured the network traffic, I see a http post to graph api successfully, and a JSON result in the response. But the code keep waiting for the method to finish.

following is my code:

I can use ActiveDirectoryClient get group ID successfully, but I meet this issue when I invoke IsMemberOfAsync.

            AuthenticationResult result = ....

            ActiveDirectoryClient adClient = new ActiveDirectoryClient(new Uri(new Uri(ConfigHelper.GraphResourceId), ConfigHelper.Tenant),
                                                async () => result.AccessToken);
            string searchString = "groupalias";
            IGroup foundGroup = null;

            try
            {
                var getGroupTask = adClient.Groups.Where(group => group.MailNickname.Equals(searchString)).ExecuteAsync();
                getGroupTask.Wait();
                var res = getGroupTask.Result;
                foundGroup = res.CurrentPage.FirstOrDefault(); // can get the group

                var isMemberTask = adClient.IsMemberOfAsync(foundGroup.ObjectId, result.UserInfo.UniqueId);
                isMemberTask.Wait(); // waiting long time without any error
                var isMember = isMemberTask.Result.Value;


            }

            catch (Exception e)
            {



            }



Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>