Hello All,

I am trying to create a little C# program that will read in a list of
users and remove them from a particular group.  I can read in the
users just fine and my code will run to the point where it appears
that the user will be removed but when I try to commit the changes I
get an error and I was wondering if anyone here could help me out a
little bit.

-------------------ERROR----------------------
Exception caught:

System.DirectoryServices.DirectoryServicesCOMException (0x80072035):
The server is unwilling to process the request.

   at System.DirectoryServices.DirectoryEntry.CommitChanges()
   at
Active_Directory.remove_users_from_pq.RemoveUsersFromGroup(String
groupName) in C:\Users\booter\Documents\Visual Studio 2010\Projects
\Active Directory\Active Directory\Remove from pqgroups.cs:line 37

-------------------CODE----------------------
public void RemoveUsersFromGroup(String groupName)
        {
            try
            {
                foreach (MyUser user in users)
                {
                    DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://CN=" + user.get_username() +
",CN=Users,DC=engr,DC=colostate,DC=edu");
                    dirEntry.Properties["memberOf"].Remove(groupName);
                    dirEntry.CommitChanges();
                    dirEntry.Close();
                }
            }
            catch (Exception Ex)
            {
                //doSomething with E.Message.ToString();
                results_box.AppendText("Exception caught: \n\n" +
Ex.ToString());

            }
        }
--------------------END------------------


This code is being run as a domain admin and pretty much taken from
examples I see online.

Any help or advice would be greatly appreciated.

Gerad Bottorff

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to