Wednesday, June 9, 2010

Difference between SPWeb.Groups and SPWeb.SiteGroups

SPWeb object offers two properties.

  • Groups
  • SiteGroups
Groups property returns all the groups listed in SPWeb object. But there needs to be atleast one permission setup in the group for the site. If we just created a group manually and not assign any permission to it, it WILL NOT appear in this group list. Also, if a new group needs to be added, Groups.Add() method cannot be used. We have to add the group using SiteGroups which gets reflected in this property for reading.

SiteGroups property returns all the grups listed in SPWeb object even if the permissions are not added to groups. SiteGroups.Add() is the method that we need to use when a new group is required to be created.

Technorati Tags: ,,,

No comments:

Post a Comment