Loading ...
Sorry, an error occurred while loading the content.

Changing password in Active Directory

Expand Messages
  • j1n0
    Hello, I m trying to write a Sharepoint Web Part that allows the user to change his password. However, I always get a binding error when using DirectoryEntry.
    Message 1 of 1 , Aug 1, 2005
    • 0 Attachment
      Hello, I'm trying to write a Sharepoint Web Part that allows the user
      to change his password. However, I always get a binding error when
      using DirectoryEntry.

      Our domain is intranet.companyname.com, all our user objects are in
      the deafult Users container, and here's my code:

      public void changePassword(object sender, EventArgs e)
      {
      try {
      DirectoryEntry entry = new
      DirectoryEntry("LDAP://CN=Jino
      Noel,CN=Users,DC=intranet,DC=companyname,DC=com");
      entry.Invoke("ChangePassword", new
      object[]{"oldpassword", "foobar"});
      }
      catch (Exception ex)
      {
      msg = ex.ToString();
      }
      }

      However when I try to run it it gives me this error:
      System.Runtime.InteropServices.COMException (0x80072020): An
      operations error occurred at
      System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at
      System.DirectoryServices.DirectoryEntry.Bind() at
      System.DirectoryServices.DirectoryEntry.get_NativeObject() at
      System.DirectoryServices.DirectoryEntry.Invoke(String methodName,
      Object[] args) at ChangePassword.ChangePassword.changePassword(Object
      sender, EventArgs e)

      Is my LDAP path wrong? Is it a permissions or previlege error? How do
      I bind correctly?
    Your message has been successfully submitted and would be delivered to recipients shortly.