Я хотел бы включить / отключить logonHours для конкретного пользователя с помощью Web api 2.0, пробовал с кодом, все работает отлично, установите / получите, кроме logonHours, пожалуйста, помогите мне.
DirectoryEntry("LDAP://test.com","Administrator", "tesT.123$"))
{
using (DirectorySearcher objAdSearcher = new DirectorySearcher(objRootEntry))
{
objAdSearcher.Filter = "(&(objectClass=user)(samAccountName=" + username + "))";
SearchResult objResult = objAdSearcher.FindOne();
if (objResult != null)
{
objResult.GetDirectoryEntry().Properties["title"].Value = "Test"; //its working fine.
byte[] logonHours = new byte[] { 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0 };
//byte[] logonHours = new byte[] {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
objResult.GetDirectoryEntry().Properties["logonHours"].Value = logonHours; //its not working, also not throwing any error
objResult.GetDirectoryEntry().CommitChanges();
}
}
}
Заранее спасибо