I'm trying to design a dialog window that will allow a user to add multiple users to multiple SharePoint groups simultaneously.

A user can be an Owner of multiple teamsites, and we need a dialog that will allow them to select one or more of these teamsites, and assign other users as Owners, Members and Visitors to all of these teamsites simultaneously.

In an ideal implementation, we need:

  • A web part that will loop through sites in a certain site collection, displaying only the ones for which the current user is a member of the relevant 'Owners' group (perhaps using SPQuery). The user will be able to use checkboxes to select multiple projects from this list.
  • Underneath this webpart will be three people pickers to allow the user to add others to the three group types.
  • A save button at the bottom which will add the selected users to the above groups for the selected teamsites.

The permissions-based site display web part is the tricky bit in my mind, so I was wondering if anybody knew of any suitable web parts, either OOB, OOB-yet-customisable or community-designed that might be of help? Something like a list view web part that displays the results of an SPQuery rather than the contents of a list/view perhaps?

Open to any ideas or suggestions regarding implementation etc.

1 Answer 1


You don't need SPQuery as it is used to get data from lists. However, you need to get the data from Site Groups. You can run the code with elevated privileges. Running the code with elevated privileges will ensure that all subsites can be traversed even if the current user may not have permissions on some or all of the subsites. This code will loop through all subsites and check if the current user is part of the Owner Groups. SPUser.Groups gives the groups associated with the user. This information can be used to check if one of the groups returned is an Owner group or not.

  • Thanks for your helpful comment Nadeem. However, I'm mostly looking for help with the webpart itself - the method of displaying the results in such a way that they can be selected for further processing.
    – Vassal
    Sep 3, 2013 at 8:50
  • I don't think there is any such OOB or community based webpaart. I guess you need to custom development for it. Sep 3, 2013 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.