1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
public void getInfo()
{
DirectoryEntry ldap = new DirectoryEntry(_rootEntry, AdAdministrator.username, AdAdministrator.password);
DirectorySearcher searcher = new DirectorySearcher(ldap);
searcher.Filter = "(sAMAccountName=" + SGI + ")";
searcher.SearchScope = SearchScope.Subtree;
searcher.SearchRoot = ldap;
SearchResult result = searcher.FindOne();
DirectoryEntry User = result.GetDirectoryEntry();
DIRECTORY_ENTRY = User;
CN = (string)DIRECTORY_ENTRY.Properties["cn"].Value;
Assistant = (System.DirectoryServices.DirectoryEntry)DIRECTORY_ENTRY.Properties["assistant"].Value;
BusinessCategory = (string)DIRECTORY_ENTRY.Properties["businessCategory"].Value;
Co = (string)DIRECTORY_ENTRY.Properties["co"].Value;
Company = (string)DIRECTORY_ENTRY.Properties["company"].Value;
CountryCode = (int)DIRECTORY_ENTRY.Properties["countryCode"].Value;
Department = (string)DIRECTORY_ENTRY.Properties["department"].Value;
Description = (string)DIRECTORY_ENTRY.Properties["description"].Value;
DisplayName = (string)DIRECTORY_ENTRY.Properties["displayName"].Value;
Division = (string)DIRECTORY_ENTRY.Properties["division"].Value;
EmployeeID = (string)DIRECTORY_ENTRY.Properties["employeeID"].Value;
FacsimileTelephoneNumber = (string)DIRECTORY_ENTRY.Properties["facsimileTelephoneNumber"].Value;
GivenName = (string)DIRECTORY_ENTRY.Properties["givenName"].Value;
HomePhone = (string)DIRECTORY_ENTRY.Properties["homePhone"].Value;
HomePostalAddress = (string)DIRECTORY_ENTRY.Properties["homePostalAddress"].Value;
Initials = (string)DIRECTORY_ENTRY.Properties["initials"].Value;
Info = (string)DIRECTORY_ENTRY.Properties["info"].Value;
IPPhone = (string)DIRECTORY_ENTRY.Properties["ipPhone"].Value;
L = (string)DIRECTORY_ENTRY.Properties["l"].Value;
Mail = (string)DIRECTORY_ENTRY.Properties["mail"].Value;
Manager = (string)DIRECTORY_ENTRY.Properties["manager"].Value;
Mobile = (string)DIRECTORY_ENTRY.Properties["mobile"].Value;
OtherFacsimileTelephoneNumber = (string)DIRECTORY_ENTRY.Properties["otherFacsimileTelephoneNumber"].Value;
OtherHomePhone = (string)DIRECTORY_ENTRY.Properties["otherHomePhone"].Value;
OtherIPPhone = (string)DIRECTORY_ENTRY.Properties["otherIpPhone"].Value;
OtherMailbox = (string)DIRECTORY_ENTRY.Properties["otherMailbox"].Value;
OtherMobile = (string)DIRECTORY_ENTRY.Properties["otherMobile"].Value;
OtherTelephone = ((string)DIRECTORY_ENTRY.Properties["otherTelephone"].Value!=null)?(string)DIRECTORY_ENTRY.Properties["otherTelephone"].Value:null;
PostalAddress = (string)DIRECTORY_ENTRY.Properties["postalAddress"].Value;
PostalCode = (string)DIRECTORY_ENTRY.Properties["postalCode"].Value;
PostOfficeBox = (string)DIRECTORY_ENTRY.Properties["postOfficeBox"].Value;
Secretary = (System.DirectoryServices.DirectoryEntry)DIRECTORY_ENTRY.Properties["secretary"].Value;
SN = (string)DIRECTORY_ENTRY.Properties["sn"].Value;
ST = (string)DIRECTORY_ENTRY.Properties["st"].Value;
Street = (string)DIRECTORY_ENTRY.Properties["street"].Value;
StreetAddress = (string)DIRECTORY_ENTRY.Properties["streetAddress"].Value;
TelephoneAssistant = (string)DIRECTORY_ENTRY.Properties["telephoneAssistant"].Value;
TelephoneNumber = (string)DIRECTORY_ENTRY.Properties["telephoneNumber"].Value;
ThumbnailPhoto = (Byte[])DIRECTORY_ENTRY.Properties["thumbnailPhoto"].Value;
Title = (string)DIRECTORY_ENTRY.Properties["title"].Value;
ThumbnailLogo = (Byte[])DIRECTORY_ENTRY.Properties["thumbnailLogo"].Value;
Photo = (Byte[])DIRECTORY_ENTRY.Properties["photo"].Value;
JpegPhoto = (Byte[])DIRECTORY_ENTRY.Properties["jpegPhoto"].Value;
} |