Bonjour à tous,
J'aimerais pouvoir delocker des utilisateurs dans AD à partir d'une page ASPx.
Voici le code implementer :
long currentValue = ADS_UF_NORMAL_ACCOUNT;
if(OUser.Properties.Contains("userAccountControl"))
{
currentValue = Convert.ToInt64(OUser.Properties["userAccountControl"].Value);
}
currentValue |= ADS_UF_NORMAL_ACCOUNT ;
currentValue &= ~ADS_UF_LOCKOUT;
OUser.Properties["userAccountControl"].Value = currentValue;
OUser.CommitChanges();
OUser.Close();
OUser est de type DirectoryEntry.
et les constantes sont :
ADS_UF_NORMAL_ACCOUNT = 0x0200
ADS_UF_LOCKOUT = 0x0010
J'ai un message d'erreur lors de l'execution du code à la ligne :
OUser.Properties["userAccountControl"].Value = currentValue;
Quelqu'un pourrait-il m'aider?
Merci d'avance
Gaetan is there, the show must go on