附加搜索选项

DirectorySearcher 包含一些附加搜索选项,您可以将它们添加到应用程序以检索可能的最佳结果集。

如果对默认服务器的搜索并没有生成结果,则该服务器可以返回对其他服务器的转交信息,以供客户端搜索。如果转交跟踪设置为“全部”,则客户端将查询在转交中指定的服务器。如果设置为“无”,则客户端将不跟踪转交。要设置转交跟踪,请使用 ReferralChasing 属性。在 ReferralChasingOption 枚举中可以找到可用于 ReferralChasing 的标志。以下代码示例说明如何设置此属性。

Dim entry As New DirectoryEntry("LDAP://CN=computers,DC=buffalo,DC=corp,DC=fabrikam,DC=com")
Dim mySearcher As New DirectorySearcher(entry)
mySearcher.ReferralChasing = ReferralChasingOption.All
' Handle results.
' Handle errors.
DirectoryEntry entry = new DirectoryEntry("LDAP://CN=computers,DC=buffalo,DC=corp,DC=fabrikam,DC=com");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.ReferralChasing = ReferralChasingOption.All;
// Handle results.
// Handle errors.

另请参见

参考

System.DirectoryServices
DirectorySearcher
ReferralChasingOption

概念

搜索目录

Send comments about this topic to Microsoft.

版权所有 (C) 2007 Microsoft Corporation。保留所有权利。