我刚刚注意到结果的返回列表限制为1000.我的域(HUGE域)中有超过1000个组.如何获得超过1000条记录?我可以从以后的记录开始吗?我可以将其剪切成多次搜索吗?
这是我的查询:
DirectoryEntry dirEnt = new DirectoryEntry("LDAP://dhuba1kwtn004");
string[] loadProps = new string[] { "cn", "samaccountname", "name", "distinguishedname" };
DirectorySearcher srch = new DirectorySearcher(dirEnt, "(objectClass=Group)", loadProps);
var results = srch.FindAll();
Run Code Online (Sandbox Code Playgroud)
我试过设置srch.SizeLimit = 2000; ,但这似乎不起作用.有任何想法吗?
如何在Active Directory中查找用户?
一些示例用户名是:
重要的是要注意我不知道域的名称,我不应该硬编码.
using System.DirectoryServices;
/// <summary>
/// Gets the email address, if defined, of a user from Active Directory.
/// </summary>
/// <param name="userid">The userid of the user in question. Make
/// sure the domain has been stripped first!</param>
/// <returns>A string containing the user's email address, or null
/// if one was not defined or found.</returns>
public static string GetEmail(string userid)
{
DirectorySearcher searcher; …Run Code Online (Sandbox Code Playgroud) 我想从Active Directory检索用户的登录名.
例如,名称是'Jan Van der Linden'在将此名称作为参数后,我必须获取他的登录名作为回报,例如jvdlinden