I use code to retrive data from accounts in AD:
public string getproperty(string userDn, string type)
{
try
{
if (userDn == null) { err = true; return null; }
DirectoryEntry uEntry = new DirectoryEntry(userDn);
if (uEntry.Properties[type].Value == null)
{
return "No record found";
}
return uEntry.Properties[type].Value.ToString();
}
catch (Exception)
{
err = true;
return null;
}
}
Unfortunatelly when I try to get "AccountExpirationDate"
getproperty(...,"AccountExpirationDate")
Function returns "No record found".
I have checked both accounts, they expires on 31.07.2011...
Why I cannot extract that property?