id stringlengths 14 16 | text stringlengths 2 3.14k | source stringlengths 45 175 |
|---|---|---|
f657ac922a10-1 | To use the example in this article, you'll need:
A SharePoint development environment (app isolation required for on-premises scenarios)
Visual Studio 2012 or Visual Studio 2013 with Office Developer Tools for Visual Studio 2012, or later
You'll also need to set Full Control add-in permissions at the Web ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
f657ac922a10-2 | // Change placeholder values before you run this code.
var listTitle = 'List 1';
var groupName = 'Group A';
var targetRoleDefinitionName = 'Contribute';
var appweburl;
var hostweburl;
var executor;
var groupId;
var targetRoleDefinitionId;
$(document).ready( function() {
//Get the URI decoded URLs.
hostweburl = dec... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
f657ac922a10-3 | executor.executeAsync({
url: endpointUri,
method: 'GET',
headers: { 'accept':'application/json;odata=verbose' },
success: function(responseData) {
var jsonObject = JSON.parse(responseData.body)
targetRoleDefinitionId = jsonObject.d.Id;
breakRoleInheritanceOfList();
},
error: er... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
f657ac922a10-4 | // Add the new role assignment for the group on the list.
function setNewPermissionsForGroup() {
var endpointUri = appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('";
endpointUri += listTitle + "')/roleassignments/addroleassignment(principalid=" + groupId;
endpointUri += ",roledefid=" + targetR... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
f657ac922a10-5 | $(document).ready( function() {
getTargetGroupId();
});
// Get the ID of the target group.
function getTargetGroupId() {
$.ajax({
url: siteUrl + '/_api/web/sitegroups/getbyname(\'' + groupName + '\')/id',
type: 'GET',
headers: { 'accept':'application/json;odata=verbose' },
success: function(respons... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
f657ac922a10-6 | // Remove the current role assignment for the group on the list.
function deleteCurrentRoleForGroup() {
$.ajax({
url: siteUrl + '/_api/web/lists/getbytitle(\'' + listTitle
+ '\')/roleassignments/getbyprincipalid(' + groupId + ')',
type: 'POST',
headers: {
'X-RequestDigest':$('#__REQUESTDIGES... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface |
0370758e36dd-0 | The code examples in this article use the REST interface and jQuery AJAX requests to add a local file to the Documents library, and then change properties of the list item that represents the uploaded file.
This process uses the following high-level steps:
Convert the local file to an array buffer by using the ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-1 | Note
Provider-hosted add-ins written in JavaScript must use the SP.RequestExecutor cross-domain library to send requests to a SharePoint domain. For an example, see upload a file by using the cross-domain library .
To use the examples in this article, you'll need the following:
SharePoint Server or SharePoin... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-2 | var appWebUrl, hostWebUrl;
jQuery(document).ready(function () {
// Check for FileReader API (HTML5) support.
if (!window.FileReader) {
alert('This browser does not support the FileReader API.');
}
// Get the add-in web and host web URLs.
appWebUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUr... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-3 | getFile.fail(onError);
// Get the local file as an array buffer.
function getFileBuffer() {
var deferred = jQuery.Deferred();
var reader = new FileReader();
reader.onloadend = function (e) {
deferred.resolve(e.target.result);
}
reader.onerror = function (e) {
deferred.reject(e.targe... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-4 | // Get the list item that corresponds to the file by calling the file's ListItemAllFields property.
function getListItem(fileListItemUri) {
// Construct the endpoint.
// The list item URI uses the host web, but the cross-domain call is sent to the
// add-in web and specifies the host web as the context si... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-5 | // Send the request and return the promise.
// This call does not return response content from the server.
return jQuery.ajax({
url: listItemEndpoint,
type: "POST",
data: body,
headers: {
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val(),
"content-type": "application/js... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-6 | jQuery(document).ready(function () {
// Check for FileReader API (HTML5) support.
if (!window.FileReader) {
alert('This browser does not support the FileReader API.');
}
});
// Upload the file.
// You can upload files up to 2 GB with the REST API.
function uploadFile() {
// Define the folder path for this ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-7 | // Get the local file as an array buffer.
function getFileBuffer() {
var deferred = jQuery.Deferred();
var reader = new FileReader();
reader.onloadend = function (e) {
deferred.resolve(e.target.result);
}
reader.onerror = function (e) {
deferred.reject(e.target.error);
}
reader... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
0370758e36dd-8 | // Change the display name and title of the list item.
function updateListItem(itemMetadata) {
// Define the list item changes. Use the FileLeafRef property to change the display name.
// For simplicity, also use the name as the title.
// The example gets the list item type from the item's metadata, but y... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery |
d8817a3bfdb4-0 | If you want to synchronize items between SharePoint and your add-ins or services, you can use the GetListItemChangesSinceToken resource to do so. The GetListItemChangesSinceToken , part of the SharePoint REST service, corresponds to the Lists.GetListItemChangesSinceToken web service call.
Perform a POST reques... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/synchronize-sharepoint-items-using-the-rest-service |
d8817a3bfdb4-1 | {
"d" : {
"query": {
"__metadata": {
"type": "SP.ChangeLogItemQuery"
},
"ViewName": "",
"Query": "
<Query>
<Where>
<Contains>
<FieldRef Name='Title' />
<Value Type='Text'>Te</Value>
</Contains>
</Where>'
</Query>,
"Que... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/synchronize-sharepoint-items-using-the-rest-service |
d8817a3bfdb4-2 | ViewName
A string that contains the GUID for the view, which determines the view to use for the default view attributes represented by the query , viewFields , and rowLimit parameters. If this argument is not supplied, the default view is assumed. If it is supplied, the value of the query , viewFields , or ro... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/synchronize-sharepoint-items-using-the-rest-service |
467f1a34f7c2-0 | When you're working with the SharePoint REST service, you'll often start out knowing the URL of a specific SharePoint item, but want to access related items, such as the folder or library structure where that item resides. For example, suppose you create an add-in where your user enters the URL of a document in a Share... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/navigate-the-sharepoint-data-structure-represented-in-the-rest-service |
467f1a34f7c2-1 | Remove the name of the specific resource from the end of the URL, so that the URL points to a document library, folder, or list. In this case: https://{site_url}/doclib/
Append the REST service pointer and the /contextinfo operator to the URL:
POST https://{site_url}/_api/doclib/contextinfo
Authorization: "Bea... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/navigate-the-sharepoint-data-structure-represented-in-the-rest-service |
467f1a34f7c2-2 | Navigate folder structure
The SharePoint REST service does not support traversing the folder hierarchy of a site through the URL construction. Instead, use the REST equivalent of the Web.GetFolderByServerRelativeUrl method. For example:
Navigation not supported through the REST service:
https://{site_url}/_vti_... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/navigate-the-sharepoint-data-structure-represented-in-the-rest-service |
467f1a34f7c2-3 | Id
Gets a value that specifies the site identifier.
Language
Gets a value that specifies the locale ID (LCID) for the language that is used on the site.
LastItemModifiedDate
Gets a value that specifies when an item was last modified on the site.
Title
Gets or sets the title for the site.
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/navigate-the-sharepoint-data-structure-represented-in-the-rest-service |
7b29be4bc288-0 | Tip
Before you start, review the following resources:
Get to know the SharePoint REST service
Navigate the SharePoint data structure represented in the REST service
Determine SharePoint REST service endpoint URIs
The SharePoint REST service supports a wide range of OData query string operators that enab... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests |
7b29be4bc288-1 | Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Bulk expansion and selection of related items isn't supported.
Select items to return
Use the $filter query option to select which items to return. OData query operators supported in the SharePoint REST service lists the filter q... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests |
7b29be4bc288-2 | Page through returned items
Use the $top and $skiptoken query options to select a subset of the items that would otherwise be returned by your query.
Note
The $skip query option does not work with queries for SharePoint list items.
The $top option enables you to select the first n items of the retur... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests |
7b29be4bc288-3 | Supported
Not supported
Numeric comparisons (lt le gt ge eq ne)
Arithmetic operators (add, sub, mul, div, mod) Basic math functions (round, floor, ceiling)
String comparisons startswith( {Col to query},'{string to check}' ) substringof( '{string to check}', {Col to query} ) eq ne
endswith, rep... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests |
7d82203e4600-0 | Tip
Before you start, review the following resources:
Get to know the SharePoint REST service
Navigate the SharePoint data structure represented in the REST service
Use OData query operations in SharePoint REST requests
SharePoint REST endpoint URI structure
Before you can access a SharePoint resource... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-1 | In some cases, however, the endpoint URI differs from the corresponding client object model signature, in order to comply with REST or OData conventions.
The following figure shows the general syntax structure of SharePoint REST URIs.
SharePoint REST URI syntax structure**
Some endpoints for SharePoint resource... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-2 | The REST service still recognizes and accepts URIs that reference the client.svc web service. For example, you can use https://{site_url}/_vti_bin/client.svc/web/lists instead of https://{site_url}/_api/web/lists . However, using _api is the preferred convention. URLs have a 256 character limit, so using _api sh... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-3 | Navigate to the specific resources you want to access
From here, construct more specific REST endpoints by "walking" the object model, using the names of the APIs from the client object model separated by a forward slash (/). The following table shows examples of client object model calls and the equivalent REST endp... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-4 | The following figure shows the SharePoint REST parameter syntax.
SharePoint REST parameter syntax
Complex types as parameters for the REST service
Some methods in the client object model require a large payload as a parameter. For REST endpoints to maintain functionality parity with their corresponding client o... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-5 | { "d" : {
"results": {
"__metadata": {
"type": "SP.ListCreationInformation"
},
"CustomSchemaXml": "…large payload…/",
"Description": "desc",
"DocumentTemplateType": "1",
"TemplateType": "101",
"Title": "Announcements"
}
}
}
Using parameter aliases in REST s... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-6 | SharePoint REST service parameter aliasing syntax
Specifying dictionaries as parameter values
For REST endpoints that correspond to methods that take Dictionary<String, String> dictionaries as parameters, pass the dictionary as a series of comma delimited name-value pairs in the query string.
REST service syn... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
7d82203e4600-7 | https://{site_url}/_api/SP.Utilities.Utility.getImageUrl('imageName')
However, static properties can be accessed only directly, and are not allowed as part of a larger URI composition. For example, directly accessing the SP.Utility.AssetsLibrary method in REST is allowable, as follows:
https://{site_url}/_api/SP.... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/determine-sharepoint-rest-service-endpoint-uris |
dbe96bda0719-0 | To get the URL of the tenant app catalog, execute the following web request:
GET https://contoso.sharepoint.com/_api/SP_TenantSettings_Current
Authorization: "Bearer " + accessToken
Accept: application/json;odata=nometadata
Note
The web request to retrieve the URL of the tenant app catalog, can be executed on ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/retrieve-tenant-app-catalog-url-rest |
9fa964ffd57a-0 | Note
The examples on this page do not support the % and # characters. Support % and # in files and folders with ResourcePath API
Tip
The SharePoint Online (and on-premises SharePoint 2016 and later) REST service supports combining multiple requests into a single call to the service by using the OData $batch... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-1 | {
"__metadata": {
"type": "SP.Folder"
},
"ServerRelativeUrl": "/document library relative url/folder name"
}
The following example shows how to rename a folder by using the MERGE method .
First, obtain the folder's OData type with a GET request.
GET https://{site_url}/_api/web/GetFolderByServerRelativ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-2 | {
"__metadata": {
"type": "{odata.type from previous call}"
},
"Title": "New name",
"FileLeafRef": "New name"
}
The following example shows how to delete a folder .
POST https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')
Authorization: "Bearer " + accessToken
If-Match: "{etag or ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-3 | /// <param name="documentLibName">MyDocumentLibrary</param>
/// <param name="fileName">test.docx</param>
/// <param name="path">C:\\</param>
public static void DownloadFileViaRestAPI(string webUrl, ICredentials credentials, string documentLibName, string fileName, string path)
{
webUrl = webUrl.EndsWith("/") ? webU... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-4 | using (WebClient client = new WebClient())
{
client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
client.Credentials = credentials;
Uri endpointUri = new Uri(webUrl + "/_api/web/GetFileByServerRelativeUrl('" + webRelativeUrl + "/" + documentLibName + "/" + fileName + "')/$value");
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-5 | "Contents of file"
The following example shows how to update a file by using the PUT method .
Note
PUT is the only method that you can use to update a file. The MERGE method is not allowed.
POST https://{site_url}/_api/web/GetFileByServerRelativeUrl('/Folder Name/{file_name}')/$value
Authorization: "Be... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-6 | "Contents of file"
If you want to update a file's metadata, you have to construct an endpoint that reaches the file as a list item. You can do this because each folder is also a list, and each file is also a list item. Construct an endpoint that looks like this: https://{site_url}/_api/web/lists/getbytitle('Documen... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-7 | Working with large files by using REST
When you need to upload a binary file that is larger than 1.5 megabytes (MB), the REST interface is your only option. For a code example that shows you how to upload a binary file that is smaller than 1.5 MB by using the SharePoint JavaScript object model, see Complete basic op... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-8 | Contents of binary file
The following code sample shows how to create a file by using this REST endpoint and the JSOM cross-domain library .
function uploadFileBinary() {
XDomainTestHelper.clearLog();
var requestExecutor;
if (document.getElementById("TxtViaUrl").value.length > 0) {
requestExecutor = new... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-9 | Working with files attached to list items by using REST
The following example shows how to retrieve all of the files that are attached to a list item .
GET https://{site_url}/_api/web/lists/getbytitle('{list_title}')/items({item_id})/AttachmentFiles/
Authorization: "Bearer " + accessToken
Accept: "application/json... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
9fa964ffd57a-10 | "Contents of file"
The following example shows how to delete a file that is attached to a list item .
DELETE https://{site_url}/_api/web/lists/getbytitle('{list_title}')/items({item_id})/AttachmentFiles('{file_name}')
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
See also
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest |
a3a67f4ae943-0 | Tip
The SharePoint Online (and on-premises SharePoint 2016 and later) REST service supports combining multiple requests into a single call to the service by using the OData $batch query option. For details and links to code samples, see Make batch requests with the REST APIs .
Prerequisites
This topic assume... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-1 | <d:ContentTypesEnabled m:type="Edm.Boolean">false</d:ContentTypesEnabled>
<d:Created m:type="Edm.DateTime">2012-06-26T23:15:58Z</d:Created>
<d:DefaultContentApprovalWorkflowId m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:DefaultContentApprovalWorkflowId>
<d:Description>A list created by Project... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-2 | <d:Hidden m:type="Edm.Boolean">true</d:Hidden>
<d:Id m:type="Edm.Guid">74de3ff3-029c-42f9-bd2a-1e9463def69d</d:Id>
<d:ImageUrl>/_layouts/15/images/itgen.gif</d:ImageUrl>
<d:IrmEnabled m:type="Edm.Boolean">false</d:IrmEnabled>
<d:IrmExpire m:type="Edm.Boolean">false</d:IrmExpire>
<d:IrmReject m:type=... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-3 | <d:ParentWebUrl>/</d:ParentWebUrl>
<d:ServerTemplateCanCreateFolders m:type="Edm.Boolean">true</d:ServerTemplateCanCreateFolders>
<d:TemplateFeatureId m:type="Edm.Guid">00bfea71-de22-43b2-a848-c05709900100</d:TemplateFeatureId>
<d:Title>Project Policy Item List</d:Title>
</m:properties>
</content>
No... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-4 | {
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 100,
"ContentTypesEnabled": true,
"Description": "My list description",
"Title": "Test"
}
The following example shows how to update a list by using the MERGE method .
POST https://{site_url}/_api/web/lists(guid'{list_... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-5 | {
"__metadata": {
"type": "SP.Field"
},
"Title": "field title",
"FieldTypeKind": FieldType value,
"Required": "true/false",
"EnforceUniqueValues": "true/false",
"StaticName": "field name"
}
The following example shows how to delete a list .
POST https://{site_url}/_api/web/lists(guid'{list_guid}... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-6 | Accept: "application/json;odata=verbose"
Retrieve specific list item
The following example shows how to retrieve a specific list item.
GET https://{site_url}/_api/web/lists/GetByTitle('Test')/items({item_id})
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
The following XML sho... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-7 | <d:Attachments m:type="Edm.Boolean">false</d:Attachments>
<d:GUID m:type="Edm.Guid">eb6850c5-9a30-4636-b282-234eda8b1057</d:GUID>
</m:properties>
</content>
Retrieve items as a stream
Retrieves information about the list and its data. Using this API you can retrieve list items in case they use complex fields... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-8 | {
"parameters": {
"AddRequiredFields": "true",
"DatesInUtc": "true",
"RenderOptions": 17
}
}
RenderListDataAsStream URI parameters
Following properties can be added as query string parameters to manipulate the returned data.
Property
Description
Type
Example
CascDelWarnMessa... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-9 | string
FilterData4
Data specified by a particular filter.
string
FilterData5
Data specified by a particular filter.
string
FilterData6
Data specified by a particular filter.
string
FilterData7
Data specified by a particular filter.
string
FilterData8
Data specif... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-10 | string
ID
FilterField7
A filter field name for a specific filter that is applied to the view.
string
ID
FilterField8
A filter field name for a specific filter that is applied to the view.
string
ID
FilterField9
A filter field name for a specific filter that is applied to the view.
st... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-11 | string
FilterFields9
Specifies multiple fields that are being filtered on for a multiplier filter.
string
FilterFields10
Specifies multiple fields that are being filtered on for a multiplier filter.
string
FilterValue
The filter value associated with a particular filter. For example, F... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-12 | string
1
FilterValue8
The filter value associated with a particular filter. For example, FilterField3 goes with FilterValue3, and so forth.
string
1
FilterValue9
The filter value associated with a particular filter. For example, FilterField3 goes with FilterValue3, and so forth.
string
1
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-13 | string
FilterValues6
Used with FilterFields for multiplier filter. For example, FilterFields3 would go with FilterValues3, and so forth.
string
FilterValues7
Used with FilterFields for multiplier filter. For example, FilterFields3 would go with FilterValues3, and so forth.
string
FilterV... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-14 | string
FilterLookupId4
Used when filtering on a lookup field. This is the item id in the foreign list that has a value that is being filtered on.
string
FilterLookupId5
Used when filtering on a lookup field. This is the item id in the foreign list that has a value that is being filtered on.
stri... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-15 | string
Geq
FilterOp2
Filter operator. Used when filtering with other operators than Eq ( Geq , Leq etc.)
string
Geq
FilterOp3
Filter operator. Used when filtering with other operators than Eq ( Geq , Leq etc.)
string
Geq
FilterOp4
Filter operator. Used when filtering with other ope... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-16 | number
InplaceSearchQuery
Search term for a full list search.
string
InplaceFullListSearch
A boolean that specifies whether there's a full list search.
string
IsCSR
Whether this view is a client side rendered view.
string
CustomAction
string
IsGroupRender
Used t... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-17 | A field that the view should be sorted on.
string
ID
SortField1
A field that the view should be sorted on.
string
ID
SortField2
A field that the view should be sorted on.
string
ID
SortField3
A field that the view should be sorted on.
string
ID
SortField4
A field that the... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-18 | The sort direction of an ad hoc sort that is being applied to the view.
string
Desc
SortDir2
The sort direction of an ad hoc sort that is being applied to the view.
string
Desc
SortDir3
The sort direction of an ad hoc sort that is being applied to the view.
string
Desc
SortDir4
The s... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-19 | ViewPath
Specifies the path of the view that will be used to render the list. If ViewId is given, then the ViewId will be used and this parameter will be ignored.
string
ViewCount
When multiple list views are on a page, this identifies one of them.
string
ViewId
Specifies the base view tha... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-20 | FolderServerRelativeUrl
Specifies the url to the folder from which to return items.
string
/sites/team-a/lists/Orders/Europe
ImageFieldsToTryRewriteToCdnUrls
Comma-separated list of field names whose values should be rewritten to CDN URLs
string
ArticleImage,SecondaryImage
OverrideViewXml
Spec... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-21 | MenuView
Return HTML for the list menu
8
ListContentType
Returns information about list content types. Must be combined with the ContextInfo flag
16
FileSystemItemId
The returned list will have a FileSystemItemId field on each item if possible. Must be combined with the ListData flag
32
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-22 | Examples
Retrieve item with specific ID
POST https://{site_url}/sites/team-a/_api/web/GetList(@listUrl)/RenderListDataAsStream?@listUrl=%27%2Fsites%2Fteam-a%2Flists%2FList%27&FilterField1=ID&FilterValue1=1
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=nometadata"
...
Sort items descendin... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-23 | {
"parameters": {
"FolderServerRelativeUrl": "/sites/team-a/lists/Orders/Europe"
}
}
Retrieve list schema
POST https://{site_url}/sites/team-a/_api/web/GetList(@listUrl)/RenderListDataAsStream?@listUrl=%27%2Fsites%2Fteam-a%2Flists%2FList%27
Authorization: "Bearer " + accessToken
Accept: "application/json;o... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-24 | {
"parameters": {
"RenderOptions": 17
}
}
Create list item
The following example shows how to create a list item.
Note
To do this operation, you must know the ListItemEntityTypeFullName property of the list and pass that as the value of type in the HTTP request body. Following is a sample rest ca... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-25 | {
"listItemCreateInfo": {
"FolderPath": {
"DecodedUrl": "https://{site_url}/lists/Test/Folder/SubFolder"
},
"UnderlyingObjectType": 0
},
"formValues": [
{
"FieldName": "Title",
"FieldValue": "Item"
}
],
"bNewDocumentUpdate": false
}
Request property details
Pro... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-26 | "ItemId": 0
}
]
}
The value property contains the list of properties that have been set when creating the list item.
Update list item
The following example shows how to update a list item.
Note
To do this operation, you must know the ListItemEntityTypeFullName property of the list and pass that a... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
a3a67f4ae943-27 | {
"__metadata": {
"type": "SP.Data.TestListItem"
},
"Title": "TestUpdated"
}
Delete list item
The following example shows how to delete a list item.
POST https://{site_url}/_api/web/lists/GetByTitle('Test')/items({item_id})
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest |
5872b2d3383c-0 | You can perform basic create, read, update, and delete (CRUD) operations by using the Representational State Transfer (REST) interface provided by SharePoint. The REST interface exposes all the SharePoint entities and operations that are available in the other SharePoint client APIs. One advantage of using REST is that... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-1 | In SharePoint, use POST to create entities such as lists and sites. The SharePoint REST service supports sending POST commands that include object definitions to endpoints that represent collections. For example, you could send a POST command that included a new list object definition in ATOM to the following URL... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-2 | To read information from a REST endpoint, you must know both the URL of the endpoint and the OData representation of the SharePoint entity that is exposed at that endpoint. For example, to retrieve all the lists in a specific SharePoint site, you would make a GET request to http://<site url>/_api/web/lists . You can... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-3 | The following code demonstrates how this request would look if you are using the cross-domain library and want to receive the OData representation of the lists as XML instead of JSON. (Because Atom is the default response format, you don't have to include an Accept header.) For more information about using the cross-... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-4 | http://<site url>/_api/web/getfilebyserverrelativeurl('/<folder name>/<file name>')/author
To get the results in JSON format, include an Accept header set to "application/json;odata=verbose" .
Writing data by using the REST interface
You can create and update SharePoint entities by constructing RESTful HTT... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-5 | "http://<site url>/_api/contextinfo");
endpointRequest.Method = "POST";
endpointRequest.Accept = "application/json;odata=verbose";
HttpWebResponse endpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
If you're using the authentication and authorization flow described in Authorization and authenticatio... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-6 | jQuery.ajax({
url: "http://<site url>/_api/web/lists/GetByTitle('Test')",
type: "POST",
data: JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'Title': 'New title' }),
headers: {
"X-HTTP-Method":"MERGE",
"accept": "application/json;odata=verbose",
... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-7 | xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag=""1"">
Creating a site with REST
The following example shows how to create a site in JavaScript.
jQuery.ajax({
url: "http://<site url>/... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-8 | How REST requests differ by environment
Building and sending an HTTP request may vary according to language, library, and add-in type, so you often need to change one or more request components when you're translating a request from one environment to another. For example, jQuery AJAX requests use data and type p... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-9 | Add-ins that use OAuth must pass access tokens in requests
Cloud-hosted add-ins use either OAuth or the cross-domain library to authorize access to SharePoint data. Add-in components with code that runs on a remote web server must use OAuth to authorize access to SharePoint data. In this case, you need to include an ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-10 | Note
An add-in web instance is required for a cloud-hosted add-in to access SharePoint data when using the cross-domain library.
Table 1. Using the SP.AppContextSite endpoint to change the context of the request
Add-in type
Cross-domain data access scenario
Example endpoint URI
Cloud-hosted ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-11 | SharePoint Add-ins can get the add-in web URL and host web URL from the query string of the add-in page, as shown in the following code example. The example also shows how to reference the cross-domain library, which is defined in the SP.RequestExecutor.js file on the host web. The example assumes that your add-in laun... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-12 | // Get the URLs for the add-in web the host web URL from the query string.
$(document).ready(function () {
//Get the URI decoded URLs.
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
// Load the SP.RequestExecutor.js... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-13 | // Get a query string value.
// For production add-ins, you may want to use a library to handle the query string.
function getQueryStringParameter(paramToRetrieve) {
var params = document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = pa... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-14 | Sends the OAuth access token (obtained from a Microsoft Access Control Service (ACS) secure token server) that's used to authenticate the user for the request. Example: "Authorization": "Bearer " + accessToken , where accessToken represents the variable that stores the token. Tokens must be retrieved by using serv... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
5872b2d3383c-15 | Provides a way to verify that the object being changed has not been changed since it was last retrieved. Or, lets you specify to overwrite any changes, as shown in the following example: "IF-MATCH":"*"
X-HTTP-Method header
POST requests for DELETE , MERGE , or PUT operations
Used to specify that the r... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints |
beaafc796d59-0 | SharePoint includes a Representational State Transfer (REST) service that is comparable to the existing SharePoint client object models . Now, developers can interact remotely with SharePoint data by using any technology that supports REST web requests. This means that developers can perform Create , Read , Update ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-1 | The client.svc web service in SharePoint handles the HTTP request and serves the appropriate response in either Atom or JavaScript Object Notation (JSON) format. Your client application must then parse that response. The following figure shows a high-level view of the SharePoint REST architecture.
SharePoint REST ser... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-2 | Update or insert a resource
PUT
Use PUT and MERGE operations to update existing SharePoint objects. Any service endpoint that represents an object property set operation supports both PUT requests and MERGE requests. For MERGE requests, setting properties is optional; any properties that you don't expli... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-3 | Social feed REST API reference for SharePoint
Following people and content REST API reference for SharePoint
For more guidelines for determining SharePoint REST endpoint URIs from the signature of the corresponding client object model APIs, see Determine SharePoint REST service endpoint URIs .
SharePoint REST ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-4 | Creates a list sample data:
{
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 104 ,
"ContentTypesEnabled": true,
"Description": "My list description ",
"Title": "RestTest "
}
Adds an item to a list sample data:
{
"__metadata": {
"type": "SP.Data.listname.... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-5 | Working with folders and files with REST
Perform basic CRUD operations on folders and files with the SharePoint REST interface.
Navigate the SharePoint data structure represented in the REST service
Start from a REST endpoint for a given SharePoint item, and navigate to and access-related items, such as paren... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
beaafc796d59-6 | SharePoint workflow fundamentals
Add search functionality to client and mobile applications using the Search REST service in SharePoint Server 2013 and any technology that supports REST web requests.
Social feed REST API reference for SharePoint
SharePoint REST endpoints for feed-related tasks.
Followin... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service |
b1c0e38c8a2c-0 | Warning
This information is only valid when you use classic SharePoint experiences in SharePoint Online or in on-premises. Usage of classic SharePoint JavaScript Client Object Model is not supported with the modern experiences or with SharePoint Framework.
You can use the SharePoint client object model to retriev... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-javascript-library-code-in-sharepoint |
b1c0e38c8a2c-1 | When you create a cloud-hosted add-in, you can add a reference to the object model by using HTML <script> tags. We recommend that you reference the host web because the add-in web may not exist in every scenario in cloud-hosted add-ins. You can retrieve the host web URL from the SPHostUrl query string parameter if ... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-javascript-library-code-in-sharepoint |
b1c0e38c8a2c-2 | // Load the required SharePoint libraries.
$(document).ready(function () {
// Get the URI decoded URLs.
hostweburl =
decodeURIComponent(
getQueryStringParameter("SPHostUrl")
);
// The js files are in a URL in the form:
// web_url/_layouts/15/reso... | https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-javascript-library-code-in-sharepoint |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.