c# - GroupPrincipal.Members.Remove() doesn't work with a large AD group -
I am using namespace classes to manage membership of several groups. These groups control the population of our print accounting system and some of them are very big I am running into a problem to remove any user from any of these groups. I have a test program that shows the problem. Note that the group I am testing is not nested, but user.IsMemberOf () also has the same problem, while GetAuthorizationGroups () correctly shows groups that The user is a member of the user, about the members of the 81 in the question group, which is not working (), and generally should have been about 65 or so.
I would be interested in hearing from others who had this problem and they resolved it, I have found an open case with Microsoft, but the call is slow on the slower because the call center is 17 hours The time difference is, before I usually do not come to work for about an hour to leave the house. Using ({var group = GroupPrincipal.FindByIdentity (context, groupName)) by using
(var context = new PrincipalContext (ContextType.Domain)) {user (user = userpinnel.findbayindtte) (Reference, Username)) {If (user! = Null) {var isMember = user.GetAuthorizationGroups () Any (G = & gt; G. Dictigenanam == Group.Discussed name); Console.light line ("1: check for subscription return: {0}", hamel); If (Group members remove (user)) {Console.WriteLine ("User successfully deleted"); Group.Save (); } Else {// do save in case () is lying in my group Save (); Console.light line ("user removal failed"); Var isStillMember = user.GetAuthorizationGroups (). Any (g = & gt; g.DistinguishedName == group.DistinguishedName); Console.lightline ("2: check for subscription return: {0}", histilam member); }}}}}}
This is a bug in group Pinyinith. Remove () code fails for a group with more than 1500 members removed. It is fixed in .NET 4.0 Beta 2. I do not know if they have planned to set the port in 2.0 / 3.x.
The work given below is to obtain the built-in directory directory, then use the IADsGroup object to execute the command.
var entry = group.GetUnderlyingObject () as DirectoryEntry; Var user entry = user.GetUnderlyingObject () as DirectoryEntry; Entry. Invoke ("remove", new object [] {user.Path});
Comments
Post a Comment