Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Help getting groups from site collection

  Asked By: Anila    Date: Feb 17    Category: Sharepoint    Views: 916

I have a Forms Based Authentication site that has a user management
webpart. This needs to get the groups from the current site collection
to let the administrator assign users they are creating to an initial
group. Currently the code gets all the groups from the current SPWeb
that the webpart is activated on using the AssociatedGroups, but I need
to expand that to all the groups in the site collection. Can someone
give me a clue as to where to begin with this?



2 Answers Found

Answer #1    Answered By: Deidra Best     Answered On: Feb 17

I would think you could either (a) walk up the object model to the current
SPWeb's parent site  (collection), or (b) start at the top by instantiating a
new SPSite with the top-level URL.

Answer #2    Answered By: Rosalinda Merrill     Answered On: Feb 17

I think what you need is:

SPGroupCollection collGroups = SPContext.Current.Web.SiteGroups;

Didn't find what you were looking for? Find more on Help getting groups from site collection Or get search suggestion and latest updates.