Check Whether SharePoint Group Exists

F

Fao, Sean

I was wondering if there was any way to programmatically determine
whether or not a group exists in SharePoint. I checked the
SPGroupCollection in the SPWeb.SiteGroups property and didn't see any
methods for doing lookups. I could obviously write my own code that
loops through each group, but I was wondering if there was an
easier/cleaner way to accomplish this task.

Thank you in advance,
 
G

Guest

I was wondering if there was any way to programmatically determine
whether or not a group exists in SharePoint. I checked the
SPGroupCollection in the SPWeb.SiteGroups property and didn't see any
methods for doing lookups. I could obviously write my own code that
loops through each group, but I was wondering if there was an
easier/cleaner way to accomplish this task.

Thank you in advance,

what about loop?

foreach(SPGroup spGroup in spWeb.SiteGroups)
{
....
}
 
Joined
Feb 10, 2010
Messages
12
Reaction score
0
SharePoint Groups vs. SiteGroups

The difference between the two are described below:

SPWeb.Groups will allow you to pull out only the groups which have some / any kind of permissions defined within the site.

SPWeb.SiteGroups will pull out all the cross-site groups irrespective of any permission defined.

So this question is answered accordingly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top