| AD属性对照表[AD域][DirectoryEntry]
					当前位置:点晴教程→知识管理交流
					
					→『 技术文档交流 』
					
				 
 AD属性对照表“常规”标签  姓  名  英文缩写  显示名称  描述  办公室  电话号码  电话号码:其它  电子邮件  网页  网页:其它  国家/地区  省/自治区  市/县  街道  邮政信箱  邮政编码   用户登录名  用户登录名(以前版本)  登录时间  登录到  用户帐户控制  帐户过期   配置文件路径  登录脚本  主文件夹:本地路径  连接  到   家庭电话  寻呼机  移动电话  传真  IP电话  注释   职务  部门  公司   隶属于  “拨入”标签  允许访问  拒绝访问  回拨选项  由呼叫方设置或回拨到  总是回拨到  1.  //GetUserEntry 2.    3.  public static DirectoryEntry GetUserEntryByAccount(DirectoryEntryentry, string account) 4.  { 5.      DirectorySearcher searcher =new
DirectorySearcher(entry); 6.      searcher.Filter = "(&(objectClass=user)(SAMAccountName=" + account +"))"; 7.      SearchResultresult = searcher.FindOne(); 8.      entry.Close(); 9.      if (result != null) 10.   
    { 11.   
        return
result.GetDirectoryEntry(); 12.   
    } 13.   
        return null; 14.   
    } 15. } 1.  //Set Property 2. 3.  public static void SetProperty(DirectoryEntry entry, string propertyName, string propertyValue) 4.  { 5.      if (entry.Properties.Contains(propertyName)) 6.      { 7.          if (string.IsNullOrEmpty(propertyValue)) 8.          { 9.               object o =
entry.Properties[propertyName].Value; 10.   
             entry.Properties[propertyName].Remove(o); 11.   
         } 12.   
         else 13.   
         { 14.   
             entry.Properties[propertyName][0] =
propertyValue; 15.   
         } 16.   
     } 17.   
     else 18.   
     { 19.   
         if (string.IsNullOrEmpty(propertyValue)) 20.   
         { 21.   
             return; 22.   
         } 23.   
         entry.Properties[propertyName].Add(propertyValue); 24.   
     } 25. } 1.  //Get Property 2.    3.  public static string GetProperty(DirectoryEntry entry, string propertyName) 4.  { 5.      if (entry.Properties.Contains(propertyName)) 6.      { 7.          return
entry.Properties[propertyName].Value.ToString(); 8.      } 9.      else 10.   
    { 11.   
        return string.Empty; 12.   
    } 13. } 该文章在 2021/6/26 23:23:13 编辑过 | 关键字查询 相关文章 正在查询... |