Exception has been thrown by the target of an invocation

  • Thread starter raj via DotNetMonster.com
  • 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();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top