Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Help getting groups from site collection

  Asked By: Anila Sisodiya         Date: Feb 17, 2009      Category: Sharepoint      Views: 205
 

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?

Tagged:            

 

2 Answers Found

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

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, 2009       

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.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].