SP.Web object
Represents a Microsoft SharePoint Foundation Web site.
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.Web()
Members
The Web object has the following members.
Constructor
The Web object has the following constructor.
Constructor |
Description |
---|---|
This member is reserved for internal use and is not intended to be used directly from your code. |
Methods
The Web object has the following methods.
Method |
Description |
---|---|
Applies the theme specified by the contents of each of the files specified in the arguments to the site. |
|
Applies the specified site definition or site template to the Web site that has no template applied to it. |
|
Deletes the Web site. |
|
Checks whether the push notification subscriber exist for the current user with the given device application instance ID. |
|
Returns whether the current user has the given set of permissions. |
|
Checks whether the specified login name belongs to a valid user in the site. If the user doesn't exist, adds the user to the site. |
|
Retrieves an AppInstance installed on this Site. |
|
Retrieves all AppInstances installed on this site that are instances of the specified App. |
|
Returns a collection of site templates available for the site. |
|
Gets the list template gallery, site template gallery, or Web Part gallery for the Web site. |
|
Returns the collection of all changes from the change log that have occurred within the scope of the site, based on the specified query. |
|
Gets the specified external content type in a line-of-business (LOB) system application. |
|
Returns the file object located at the specified server-relative URL. |
|
Returns the folder object located at the specified server-relative URL. |
|
Gets the push notification subscriber over the site for the specified device application instance ID. |
|
Queries for the push notification subscribers over the site for the specified value of custom arguments. Null or empty custom arguments will return subscribers without any filtering. |
|
Queries for the push notification subscribers over the site for the specified user. |
|
Returns the collection of child sites of the current site based on the specified query. |
|
Returns the user corresponding to the specified member identifier for the current site. |
|
Gets the effective permissions that the specified user has within the current application scope. |
|
Uploads and installs an app package to this site. |
|
Uploads and installs an App package on the site in a specified locale. |
|
Uploads an App package and creates an instance from it. |
|
Returns the name of the image file for the icon that is used to represent the specified file. |
|
Registers the subscriber for push notifications over the site. If the registration already exists, the service token is updated with the new value. |
|
Unregisters the subscriber for push notifications from the site. |
|
Updates the database with changes that are made to the Web site. |
Properties
The Web object has the following properties.
Property |
Description |
---|---|
Gets a value that specifies whether the current user is allowed to use a designer application to customize this site. |
|
Gets a value that specifies whether the current user is allowed to edit the master page. |
|
Gets a value that specifies whether the current user is allowed to revert the site to a default site template. |
|
Gets a value that specifies whether the site allows RSS feeds. |
|
Gets a collection of metadata for the Web site. |
|
The instance Id of the App Instance that this web represents. |
|
Gets or sets the group of users who have been given contribute permissions to the Web site. |
|
Gets or sets the associated owner group of the Web site. |
|
Gets or sets the associated visitor group of the Web site. |
|
Gets the collection of all content types that apply to the current scope, including those of the current Web site, as well as any parent Web sites. |
|
Gets a value that specifies the collection of all fields available for the current scope, including those of the current site, as well as any parent sites. |
|
Gets either the identifier (ID) of the site definition configuration that was used to create the site, or the ID of the site definition configuration from which the site template used to create the site was derived. |
|
Gets the collection of content types for the Web site. |
|
Gets a value that specifies when the site was created. |
|
Gets the current user of the site. |
|
Gets or sets the URL for a custom master page file to apply to the website. |
|
Gets or sets the description for the site. |
|
Determines if the Document Library Callout's WAC previewers are enabled or not. |
|
Gets a value that specifies the effective permissions that are assigned to the current user. |
|
Gets or sets a Boolean value that specifies whether the Web site should use Minimal Download Strategy. |
|
Gets the collection of event receiver definitions that are currently available on the website. |
|
Gets a value that specifies the collection of features that are currently activated in the site. |
|
Gets the collection of field objects that represents all the fields in the Web site. |
|
Gets the collection of all first-level folders in the Web site. |
|
Gets a value that specifies the site identifier for the site. |
|
Gets a value that specifies the LCID for the language that is used on the site. |
|
Gets a value that specifies when an item was last modified in the site. |
|
Gets the collection of all lists that are contained in the Web site available to the current user based on the permissions of the current user. |
|
Gets a value that specifies the collection of list definitions and list templates available for creating lists on the site. |
|
Gets or sets the URL of the master page that is used for the website. |
|
Gets a value that specifies the navigation structure on the site, including the Quick Launch area and the top navigation bar. |
|
Gets the parent website of the specified website. |
|
Gets the collection of push notification subscribers over the site. |
|
Gets or sets a value that specifies whether the Quick Launch area is enabled on the site. |
|
Specifies the collection of recycle bin items of the recycle bin of the site. |
|
Gets or sets a value that determines whether the recycle bin is enabled for the website. |
|
Gets the regional settings that are currently implemented on the website. |
|
Gets the collection of role definitions for the Web site. |
|
Gets the root folder for the Web site. |
|
Gets or sets a Boolean value that specifies whether the Web site can be saved as a site template. |
|
Gets or sets the server-relative URL for the Web site. |
|
Gets a value that specifies whether the current user is able to view the file system structure of this site. |
|
Gets the collection of groups for the site collection. |
|
Gets the UserInfo list of the site collection that contains the Web site. |
|
Gets the collection of all users that belong to the site collection. |
|
Specifies the language code identifiers (LCIDs) of the languages that are enabled for the site. |
|
Gets or sets a value that specifies whether the RSS feeds are enabled on the site. |
|
The theming information for this site. This includes information like colors, fonts, border radii sizes etc. |
|
Gets or sets the title for the Web site. |
|
Gets or sets value that specifies whether the tree view is enabled on the site. |
|
Gets or sets the user interface (UI) version of the Web site. |
|
Gets or sets a value that specifies whether the settings UI for visual upgrade is shown or hidden. |
|
Gets the absolute URL for the website. |
|
Gets a value that specifies the collection of user custom actions for the site. |
|
Gets a Web site collection object that represents all Web sites immediately beneath the Web site, excluding children of those Web sites. |
|
Gets the name of the site definition or site template that was used to create the site. |
|
Gets a value that specifies the collection of all workflow associations for the site. |
|
Gets a value that specifies the collection of workflow templates associated with the site. |
Example
The following example creates an input button on an application page that displays information about a subsite.
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">
var targetWeb;
function runCode() {
// Specify a client context using the server-relative URL of the sub web, load the sub web, and call the ExecuteQueryAsync method.
var clientContext = new SP.ClientContext('/MySubWeb');
targetWeb = clientContext.get_web();
clientContext.load(targetWeb);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
// On success, use get_ property assessor methods to return the value of the Title, ID, Language, uiVersion, Description, and Created properties of the SP.Web object.
var message = "Web retrieved:";
message += "\n Title: " + targetWeb.get_title();
message += "\n ID: " + targetWeb.get_id();
message += "\n Language: " + targetWeb.get_language();
message += "\n UI Version: " + targetWeb.get_uiVersion();
message += "\n Description: " + targetWeb.get_description();
message += "\n Created: " + targetWeb.get_created();
alert(message);
}
function onQueryFailed(sender, args) {
alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
}
</script>
<input id="Button1" type="button" value="Run Code" onclick="runCode()" />
</asp:Content>
REST resource endpoint
See Web resource for more information.
Endpoint URI structure
http://<sitecollection>/<site>/_api/web
HTTP requests
This resource supports the following HTTP commands:
DELETE syntax
DELETE http://<sitecollection>/<site>/_api/web
MERGE syntax
MERGE http://<sitecollection>/<site>/_api/web
POST syntax
POST http://<sitecollection>/<site>/_api/web
PUT syntax
PUT http://<sitecollection>/<site>/_api/web