📜  .net directorysearcher 获取经理帐户名 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:48.494000             🧑  作者: Mango

代码示例1
if (userAccount.Properties["manager"].Value != null)
{
  DirectorySearcher search2 = new DirectorySearcher(domain.GetDirectoryEntry())
  {
    Filter = string.Format("(distinguishedName={0})", userAccount.Properties["manager"].Value)
  };
  search2.PropertiesToLoad.Add("displayName");
  search2.PropertiesToLoad.Add("mail");
  search2.PropertiesToLoad.Add("manager");
  DirectoryEntry mgrAcc = search2.FindOne()?.GetDirectoryEntry();
}