基于名字,姓氏和显示名称在Active Directory中搜索用户 [英] Search Users in Active Directory based on First Name, Last Name and Display Name

查看:199
本文介绍了基于名字,姓氏和显示名称在Active Directory中搜索用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图寻找用户我的组织活动目录。

I trying to search my organization Active directory for users.

如果将名字名字显示名称匹配特定的字符串值,它应该返回的用户。

If the FirstName or LastName or DisplayName matches a particular string value, it should return the users.

我的code:

// create your domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);

UserPrincipal qbeUser = new UserPrincipal(ctx);
qbeUser.GivenName = "Ramesh*";
// qbeUser.Surname = "Ramesh*";
// qbeUser.DisplayName= "Ramesh*";    

PrincipalSearcher srch = new PrincipalSearcher(qbeUser);

// find all matches
foreach(var found in srch.FindAll())
{
    //
}

的问题是,我能够仅通过一个过滤器,以搜寻

The problem is that I am able to search by only one filter.

我能够和过滤器而不是OR。是否有任何解决方案可供选择?

I am able to AND the filters but not OR. Whether any solutions are available?

推荐答案

<一个href="http://stackoverflow.com/questions/3195124/ambiguous-name-resolution-anr-ma-equivalent-in-net-3-5-directoryservices-ac">See针对此问题在此以外的其他可能的解决方案,因此质疑。

您将需要使用的可扩展性 UserPrincipal 来创建一个子类,以获得进入 ANR 属性(ANR =模糊名称解析),它允许多个名称相关的属性的搜索一次。

You will need to use the extensibility of UserPrincipal to create a descendant class, in order to get access to the anr property (anr = ambiguous name resolution) which allows searches in multiple name-related properties at once.

这篇关于基于名字,姓氏和显示名称在Active Directory中搜索用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆