none
Account expires value in LDAP. RRS feed

  • Question

  • var rootEntry = new DirectoryEntry("LDAP://xxx.com");
    var directorySearcher = new DirectorySearcher(rootEntry, String.Format("(sAMAccountName={0})", acctName));
    var searchResult = directorySearcher.FindOne();
    if (searchResult != null)
    {                   
           using (var userEntry = searchResult.GetDirectoryEntry())
           {            
                 PropertyValueCollection acc = (PropertyValueCollection)userEntry.Properties["accountexpires"];
                 long accountExp = 0;// (long)acc[0].Value;
                  DateTime dt = new DateTime(1601, 01, 02).AddTicks(accountExp);
            }
    }

    How do I get the account expire into a DateTime value?

    Monday, September 10, 2018 6:21 PM

Answers

All replies