Adding Collection of SPUsers into SPGroup

1k Views Asked by At


We can add an SPUser into an SPGroup by objSPGroup.Users.Add(objSPUser). I need to add SPUserCollection into one SPGroup.
How can i do it?

1

There are 1 best solutions below

1
On

SPGroup actually contains an SPUserCollection object, representing the containing users. I don't see how you could overload this. There also isn't any method to add a full SPUserCollection to a SPGroup.

What I think you are best of doing is to iterate through SPUserCollection.GetCollection (MSDN reference) users and adding them one by one to your SPGroup