SP.List object
Represents a list on a SharePoint Web site.
Last modified: March 09, 2015
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.List()
The List object has the following members.
Constructor
The List object has the following constructor.
Methods
The List object has the following methods.
|
Method |
Description |
|---|---|
|
Creates a new list item in the list. |
|
|
Deletes the list. |
|
|
Returns the collection of changes from the change log that have occurred within the list, based on the specified query. |
|
|
Returns the list item with the specified list item identifier. |
|
|
Returns a collection of items from the list based on the specified query. |
|
|
|
|
|
Returns a collection of lookup fields that use this list as a data source and that have FieldLookup.IsRelationship set to true. |
|
|
This member is reserved for internal use and is not intended to be used directly from your code. |
|
|
|
|
|
Returns the list view with the specified view identifier. |
|
|
Moves the list to the Recycle Bin and returns the identifier of the new Recycle Bin item. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Updates the database with changes that are made to the list. |
Properties
The List object has the following properties.
|
Property |
Description |
|---|---|
|
Gets a value that specifies whether the list supports content types. |
|
|
Gets the list definition type on which the list is based. |
|
|
Gets the base type for the list. |
|
|
Gets a value that specifies the override of the web application's BrowserFileHandling property at the list level. |
|
|
Gets the content types that are associated with the list. |
|
|
Gets or sets a value that specifies whether content types are enabled for the list. |
|
|
Gets a value that specifies when the list was created. |
|
|
Gets the data source associated with the list, or null if the list is not a virtual list. |
|
|
Gets or sets a value that specifies the default workflow identifier for content approval on the list. |
|
|
Gets or sets a value that specifies the location of the default display form for the list. |
|
|
Gets or sets a value that specifies the URL of the edit form to use for list items in the list. |
|
|
Gets or sets a value that specifies the location of the default new form for the list. |
|
|
|
|
|
Gets the URL of the default view for the list. |
|
|
Gets or sets a value that specifies the description of the list. |
|
|
Gets or sets a value that specifies the reading order of the list. |
|
|
Gets or sets a value that specifies the server-relative URL of the document template for the list. |
|
|
Gets or sets a value that specifies the minimum permission required to view minor versions and drafts within the list. |
|
|
Gets a value that specifies the effective permissions on the list that are assigned to the current user. |
|
|
|
|
|
Gets or sets a value that specifies whether list item attachments are enabled for the list. |
|
|
Gets or sets a value that specifies whether new list folders can be added to the list. |
|
|
Gets or sets a value that specifies whether minor versions are enabled for the list. |
|
|
Gets or sets a value that specifies whether content approval is enabled for the list. |
|
|
Gets or sets a value that specifies whether historical versions of list items and documents can be created in the list. |
|
|
|
|
|
|
|
|
Gets a value that specifies the collection of all fields in the list. |
|
|
Gets or sets a value that indicates whether forced checkout is enabled for the document library. |
|
|
Gets a value that specifies the collection of all list forms in the list. |
|
|
Gets a value that specifies whether the list is an external list. |
|
|
Gets or sets a Boolean value that specifies whether the list is hidden. |
|
|
Gets the GUID that identifies the list in the database. |
|
|
Gets a value that specifies the URI for the icon of the list. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gets or sets a value that specifies a flag that a client application can use to determine whether to display the list. |
|
|
Gets a value that specifies whether the list is a gallery. |
|
|
|
|
|
Gets a value that indicates whether the list is designated as a default asset location for images or other files which the users upload to their wiki pages. |
|
|
Gets a value that specifies the number of list items in the list. |
|
|
Gets a value that specifies the last time a list item was deleted from the list. |
|
|
Gets a value that specifies the last time a list item, field, or property of the list was modified. |
|
|
|
|
|
Gets or sets a value that indicates whether the list in a Meeting Workspace site contains data for multiple meeting instances within the site. |
|
|
Gets or sets a value that specifies that the crawler must not crawl the list. |
|
|
Gets or sets a value that specifies whether the list appears on the Quick Launch of the site. |
|
|
Gets a value that specifies the site that contains the list. |
|
|
Gets a value that specifies the server-relative URL of the site that contains the list. |
|
|
Gets the root folder that contains the files in the list and any related files. |
|
|
Gets a value that specifies the list schema of the list. |
|
|
Gets a value that indicates whether folders can be created within the list. |
|
|
Gets a value that specifies the feature identifier of the feature that contains the list schema for the list. |
|
|
Gets or sets the displayed title for the list. |
|
|
Gets a value that specifies the collection of all user custom actions for the list. |
|
|
Gets or sets a value that specifies the data validation criteria for a list item. |
|
|
Gets or sets a value that specifies the error message returned when data validation fails for a list item. |
|
|
Gets a value that specifies the collection of all public views on the list and personal views of the current user on the list. |
|
|
Gets a value that specifies the collection of all workflow associations for the list. |
The following example creates an input button on an application page that creates a new discussion board list on the current web site.
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> <script type="text/ecmascript" language="ecmascript"> var list; function runCode() { var clientContext = new SP.ClientContext.get_current(); if (clientContext != undefined && clientContext != null) { var web = clientContext.get_web(); // Specify the properties of the new list. var listCreationInfo = new SP.ListCreationInformation(); listCreationInfo.set_title('New Discussion Board'); listCreationInfo.set_templateType(SP.ListTemplateType.discussionBoard); this.list = web.get_lists().add(listCreationInfo); clientContext.load(list); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); } } function onQuerySucceeded() { var result = ' Added Discussion Board: ' + this.list.get_title(); alert(result); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); } </script> <input id="Button1" type="button" value="Run Code" onclick="runCode()" /> </asp:Content>
See List resource for more information.
Endpoint URI structure
http://<sitecollection>/<site>/_api/web/lists(listid)
HTTP requests
This resource supports the following HTTP commands:
DELETE syntax
DELETE http://<sitecollection>/<site>/_api/web/lists(listid)
MERGE syntax
MERGE http://<sitecollection>/<site>/_api/web/lists(listid)
POST syntax
POST http://<sitecollection>/<site>/_api/web/lists(listid)
PUT syntax
PUT http://<sitecollection>/<site>/_api/web/lists(listid)