SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to show members and owners in a webpart. My site collection can be created in different languages, so I can't get needed groups like web.Groups["Contoso Members"]. Because it may be "Medlemmar på Contoso" or something else.

When I ran $web.Groups I saw Members group had id 5.

Can I trust this id number? Or is it random number?

SPGroup members = web.Groups[5]
foreach (SPUser user in members.Users)
   //show it
share|improve this question
up vote 5 down vote accepted

You can't count on that number, as it's just the index within the collection.

The AssociatedMemberGroup and AssociatedOwnerGroup properties on SPWeb should give you what you're looking for without having to know the actual name of the group.

share|improve this answer
Thank you very much. It is exactly what I needed! – Anatoly Mironov Jul 25 '11 at 13:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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