Gets the collection of user objects that are explicitly assigned permissions in the website.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
The following code example uses the Users property to return the collection of users in a specified website of the current site collection.
Using webSite As SPWeb = SPContext.Current.Site.OpenWeb("Website_URL") Dim users As SPUserCollection = webSite.Users Dim user As SPUser For Each user In users Response.Write((SPEncode.HtmlEncode(user.Name) + "<BR>")) Next End Using
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.