0
我從活動目錄獲取組名稱。但我需要郵寄這些團體,如GR-所有@布拉布拉......或GR-IT軟件@布拉布拉的地址...如何獲得ActiveDirectory組郵件地址
這裏是我讓組代碼..
string groupName = String.Empty;
int startIndex = 0;
DirectoryEntry de = new DirectoryEntry("LDAP://blabla");
DirectorySearcher searcher = new DirectorySearcher(de);
searcher.Filter = "(&(&(objectClass=group)(objectcategory=group))(name=*" + pSearchText + "*))"; //this contain filter for adgroups from textbox
searcher.PropertiesToLoad.Add("name");
SearchResultCollection results = searcher.FindAll();
foreach (SearchResult result in results)
{
de = result.GetDirectoryEntry();//de object has a lot of properties but not include e mail address, or it is include I can't see that.
groupName = de.Name;
startIndex = groupName.IndexOf('=') + 1;
groupName = groupName.Substring(startIndex, groupName.Length - startIndex);
groupNames.Add(groupName);