Search This Blog

2009-04-30

SPWeb

What is SPWeb/What are the method and properties of SPWEB:-
SPWeb object represent a Sharepoint WebSite. SPWeb object can be obtained using SPSite and SPContext.

Ex:-
· SPWeb website = SPContext.Current.Web;
· SPWeb webSite1 = site.OpenWeb(“URl”); Here site is an SPSite Object.

Properties:-


Alerts
Gets the collection of alerts for the site or subsite.
AllowUnsafeUpdates
Gets or sets a Boolean value that specifies whether to allow updates to the database as a result of a GET request or without requiring a security validation.
AllUsers
Gets the 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.
AvailableContentTypes
Gets the collection of all content type templates for the current scope, including those of the current Web site, as well as of any parent sites.
AvailableFields
Gets the collection of the available fields of the Web site.
ContentTypes
Gets the collection of content types for the Web site.
CurrentUser
Gets the current user of the site.
EventReceivers
Gets the collection of event receiver definitions that are currently available on the Web site.
Exists
Gets a Boolean value that indicates whether the Web site exists.
Features
Gets the collection of Features that are currently activated in the Web site.
Fields
Gets the collection of field objects that represents all the fields in the Web site.
Files
Gets the collection of all files in the root directory of the Web site.
Folders
Gets the collection of all first-level folders in the Web site.
Groups
Gets the collection of cross-site groups for the site.
ID
Gets the GUID for the site.
IsRootWeb
Gets a Boolean value that indicates whether the site is the top-level Web site of the site collection.
Site
Gets the parent site collection for the Web site.
SiteGroups
Gets the collection of cross-site groups for the site collection.
SiteUsers
Gets the collection of all users that belong to the site collection.
Url
Gets the absolute URL for the Web site.
Users
Gets the collection of user objects that are explicitly assigned permissions on the Web site.
Lists
Gets the collection of all lists that are contained in the Web site

Methods:-


Close
Closes the Web site at the end of a request and releases resources.
Delete
Deletes the Web site.
EnsureUser
Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
GetFile
Overloaded. Returns the file object with the specified GUID or the file object that is located at the specified URL.
GetFolder
Overloaded. Returns the folder object with the specified GUID or the folder object that is located at the specified URL.
GetList
Returns the list that is associated with the specified site-relative URL.
GetListItem
Returns the list item that is associated with the specified server-relative URL.
GetSiteData
Performs a query for list items across multiple lists, which can be located in multiple Web sites in the same Web site collection.
Update
Updates the database with changes that are made to the Web site.

No comments: