Question : LDAP Password Unlock/ Reset Error

                DirectoryEntry de = GetDirectoryEntry();


                DirectorySearcher searcher = new DirectorySearcher(de);

                searcher.Filter = "(CN=" +cn+ ")";

                      searcher.CacheResults = false;

                SearchResult result = searcher.FindOne();

                de = result.GetDirectoryEntry();

                de.Properties["LockOutTime"].Value = 0x0000;

    // It gives error after this

                de.Invoke("SetPassword", new object[] { newPassword });

                de.CommitChanges();

Answer : LDAP Password Unlock/ Reset Error

Here is a version of your code that works

            DirectoryEntry de = new DirectoryEntry("LDAP://CN=Users,DC=xxx,DC=com");

            DirectorySearcher searcher = new DirectorySearcher(de);
            searcher.Filter = "(CN=" + "gautam reddyc" + ")";
            searcher.CacheResults = false;
            SearchResult result = searcher.FindOne();

            de = result.GetDirectoryEntry();
            de.Properties["LockOutTime"].Value = 0x0000;
            de.CommitChanges();
Random Solutions  
 
programming4us programming4us