大网数据广告活动
域与目录服务

Deciding What to Find

· 52CE 我爱测

Before you search a directory, consider how your search will perform based on your approach. The data and properties to be returned affect where you bind to start a search, the depth of your search, your query filter, and search performance.

Before you search a directory, consider how your search will perform based on your approach. The data and properties to be returned affect where you bind to start a search, the depth of your search, your query filter, and search performance.

For example, if you want search for all user objects with surname Smith:

Area Description
Where to search A specific container or organizational unit (OU) within a domain, a specific domain, a specific domain tree, or the entire forest. If you search for objects within a specific container or domain, the search query will perform better by binding directly to that container or domain instead of performing a subtree search on a domain tree.
Type of search If you verify the existence of, or retrieve the properties of a particular object that has a distinguished name (DN) you already know, you should perform a base search, which searches only the object you have bound to. If you know an object is a direct descendant of a particular container, bind to that container and do a one-level search (attributeSchema and classSchema objects in the schema container and extended-right objects in the extended-rights container are good examples). If you do not know exactly where the object is, or if you want to search the object you have bound to and all the child objects below it in the directory hierarchy, perform a subtree search.
Use indexes where possible Finally, if you look for a specific class of object, the query filter should have expressions that evaluate properties that are defined for that class. To search for group objects, include the expression (objectCategory=group) in the filter. To search for user objects, specify (&(objectClass=user)(objectCategory=person)) because the computer class derives from the user class, so (objectClass=user) would return both users and computers and also because both contact and user objects have an objectCategory of person, so (objectCategory=person) would return both users and contacts. For more information, see Object Class and Object Category and Indexed Attributes.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。