Using PrincipalSearcher to find users with “or” parameters

前端 未结 5 1849
情歌与酒
情歌与酒 2020-12-30 20:07

Is it possible to use System.DirectoryServices.AccountManagement.PrincipalSearcher to search based on multiple parameters using \"or\" (not \"and\").

i.

5条回答
  •  甜味超标
    2020-12-30 21:04

    PrincipalContext pContext = new PrincipalContext(ContextType.Machine, Environment.MachineName);
    GroupPrincipal gp = GroupPrincipal.FindByIdentity(pContext, "Administrators");
    bool isMember = UserPrincipal.Current.IsMemberOf(gp);
    

提交回复
热议问题