Exception has been thrown by the target of an invocation

  • Thread starter Thread starter raj via DotNetMonster.com
  • Start date Start date
R

raj via DotNetMonster.com

I am getting the exception when i invoke the
Password,
Exception is

"Exception has been thrown by the target of an invocation."

DirectoryEntry ent = new DirectoryEntry
("LDAP://server01:389/DC=chm,DC=com","abc","test");

DirectoryEntry oue = ent.Children.Find("OU=test");
DirectoryEntry Objusr = oue.Children.Add("CN="+ username,"user");
Objusr.Properties["samAccountName"].Value = username;
Objusr.Properties["givenName"].Value = Fstname;
Objusr.Properties["sn"].Value = Lstname;
Objusr.Properties["userPrincipalName"].Value = username;

Objusr.Properties["mail"].Value = email;
Objusr.CommitChanges();

Objusr.Invoke("SetPassword","test");
Objusr.CommitChanges();
 
Back
Top