Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# GroupPrincipal ismember

$
0
0

Dear Exprt,

Althought user member for group value come in false

bool result = true;
                PrincipalContext context = new PrincipalContext(ContextType.Domain, "Mydomain");
                UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(context, "test1");
                GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(context, "ADgroup");
                if (userPrincipal != null && groupPrincipal != null)
                {
                    Console.WriteLine(groupPrincipal.Members.Contains(userPrincipal).ToString());
                                       
                }

                else
                {
                    Console.WriteLine(result);
                }


Support@Mytechnet.me


Viewing all articles
Browse latest Browse all 31927

Trending Articles



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