Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

User Collections / SPWeb...

  Asked By: Madhu    Date: Jul 23    Category: Sharepoint    Views: 1440

I have noticed that there are three properties (AllUsers, SiteUsers,
and Users) that expose a SPUserCollection object.

Each of these SPUserCollection objects appears to contain different
sets of users.

Basically, my question is what collection contains what user? How
are users added to each of these collections? How are users removed
from these collections?

I will start with the easy one. The documentation states that the
SPWeb.Users property is a "collection of user objects that are
explicitly assigned permissions on the Web site." It appears that
users that have been given permissions via that Site Settings-
>Permissions page are added to the SPWeb.Users collection. When I
add a user and assign them permissions via the Site Settings-
>Permissions page, the user shows up in the collection. When I
remove this permission, they are removed from the collection. This
makes sense.

Next, there is the SPWeb.AllUsers collection. The documentation
states that this collection is a "collection of user objects that
represents all users who are either members of the site or who have
browsed to the site as authenticated members of a domain group in the
site." I understand this description to the point of how users are
added to the collection. However, if I either remove the user as a
member of the site or remove the domain groups that the user belongs
to as a member of the site the user is still in the collection. How
are users removed from this collection?

Finally, there is the SPWeb.SiteUsers collection. The documentation
states that this collection is a "collection of all users that belong
to the site collection." This collection appears to behave similar
to the SPWeb.AllUsers collection except that users show up in this
group immediately when added to a group or are marked as a site
administrator. Similar to the SPWeb.AllUsers collection, how are
users removed from this collection?

If someone can shed some light on the questions I have asked I would
greatly appreciate it.



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on User Collections / SPWeb... Or get search suggestion and latest updates.