AD屬性對照表[AD域][DirectoryEntry]
當前位置:點晴教程→知識管理交流
→『 技術文檔交流 』
AD屬性對照表“常規”標簽 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 編輯過 |
關鍵字查詢
相關文章
正在查詢... |