In LDAP, Property Collection is consisted of string and ActiveDs DataTypes.
For example, if Property.Value is large integer type, this value can cast by ActiveDs.IADsLargeInteger.
this is sample code :
try { string ldap = String.Format("LDAP://{0}", ldapServer); DirectoryEntry entry = new DirectoryEntry(ldap); entry.Username = SyncmailConstants.DefaultAdminId; entry.Password = SyncmailConstants.DefaultAdminPassword; DirectorySearcher seacher = new DirectorySearcher(entry, "OU=mailpushcokr"); SearchResult searchresult = seacher.FindOne(); DirectoryEntry ouentry = searchresult.GetDirectoryEntry(); MembershipUserStatics statics = new MembershipUserStatics(); foreach (DirectoryEntry entity in ouentry.Children) { if(entity.Properties.Contains("givenName")) { if (entity.Properties["givenName"].Value.ToString() == "대리점가입자") { statics.TotalUkeyUserCount++; if (!entity.Properties.Contains("lastLogonTimestamp")) { statics.UnusedUkeyUserCount++; } } else { if (!entity.Properties.Contains("lastLogonTimestamp")) { statics.UnuseWebUserCount++; } else { ActiveDs.IADsLargeInteger largeIntADSI = (ActiveDs.IADsLargeInteger) entity.Properties["lastLogonTimestamp"][0]; Console.WriteLine(largeIntADSI.HighPart); } } statics.TotalUserCount++; } } return statics; } catch (Exception ex) { Console.WriteLine(ex.Message); return new MembershipUserStatics(); }