Hot answers tagged

50 votes
Accepted

REST expand people column

Try AssignedTo/EMail....case sensitive. Available values from a user field (Source): Title Name EMail MobilePhone SipAddress Department JobTitle FirstName LastName WorkPhone UserName ...
  • 696
45 votes
Accepted

REST API OData Filter on Boolean not Working

Try using 1 for true, 0 for false. I was able to replicate your problem in SPO, but using 1/0 worked fine: /_api/web/lists/getbytitle('BtProjects')/items?$filter=Active eq 1
  • 5,720
39 votes
Accepted

Send E-mail from javascript using REST API

In SharePoint 2013 On Premise we can send emails using REST API where we can utilise SP.Utilities.Utility.SendEmail for doing the job. Note: The recipient is limited to a valid SharePoint user for ...
  • 5,953
34 votes
Accepted

Rest API - $filter multiple values

As far as I know, you can not use &. You have to use and or or inside the filter. So try using something like that: /_api/web/lists/getbytitle('Students')/items?$select=Title,ZIP&$filter=((...
  • 3,167
30 votes
Accepted

Getting document name using REST (not title) while filtering document library

How to retrieve document name using SharePoint REST Since FileRef contains file name, you could utilize the following query to return document names: Endpoint: /_api/web/lists/getByTitle('<list ...
29 votes

How to select and filter list items lookup column with Sharepoint 2013 REST Feature?

How to filter by lookup field value using SharePoint REST Assume a Contacts list that contains a lookup field named Province Option 1 Once a lookup column is getting added into list, its ID become ...
29 votes

How to get all items in a view using REST API

The following example demonstrates how to retrieve list items for a View using SharePoint REST: function getListItems(webUrl,listTitle, queryText) { var viewXml = '<View><Query>' + ...
28 votes
Accepted

SharePoint 2013 REST - Create list item with user field and lookup field

It depends whether User/Lookup field value is multiple or not, the following formats are used when specifying field value via SharePoint REST: Single User/Lookup value format: FieldName: LookupIdVal ...
28 votes

Order by Rest API in SharePoint 2013

You should add order by in the REST query itself as below: /_api/web/lists/getbytitle('GoGreenReport')/items?$select=EncodedAbsUrl,FileRef&$filter=Project_x0020_Name eq '"+$("#ddnProjectName")....
  • 30.5k
27 votes
Accepted

How to get SPFieldChoice values using rest api SharePoint 2013?

I have solved my problem following way $.ajax({ url: "host url"+"_api/web/lists/GetByTitle('List Name')/fields?$filter=EntityPropertyName eq 'Choice Field Name'", type: "GET", ...
26 votes
Accepted

REST with $filter for List Items in Sharepoint 2013

It does not seem possible to filter list items using FileSystemObjectType property in SharePoint 2013 REST. Option 1 But you could utilize the following REST query to return folders and associated ...
21 votes
Accepted

SharePoint 2013 REST api to update list item- Uncaught ReferenceError: etag is not defined

This error occurs since tag variable is not defined. About eTag When updating or deleting items within SharePoint lists via REST you must specify the Entity Tag (eTag) value that was returned ...
20 votes
Accepted

Get the group of the current user using REST API

The following example demonstrates how to determine whether current users belongs to the specified groups: getCurrentUserWithDetails() .done(function(data) { var groupNames = ['News Owners','...
19 votes
Accepted

how to get last ten item with REST API

For listing item in a particular order you should use orderby in the URL var queryGet = "?filter=Title ne 'reply'&$top=10&$orderby=Created desc"
  • 28.2k
19 votes
Accepted

Get all Files and Folders in one call

You could try the following endpoint: https://server/_api/Web/GetFolderByServerRelativeUrl(<folder url>)?$expand=Folders,Files It returns files and folders beneath folder at the specified url. ...
17 votes
Accepted

getFileByServerRelativeURL fails when the filename contains a quote

Try putting extra apostrophe. That is, use Web/getfilebyserverrelativeurl("/Shared Documents/Roy''s quoted doc.txt")
16 votes

Get ContentType name with select fields

Add ContentTypeId to your select. In an on premise SP 2013 environment I found this is an important key. To return the ContentType Name, it is not enough to expand the content type. You also have to ...
  • 161
16 votes
Accepted

Manage File permissions using REST API

In order to manage unique permissions for a Securable Object like List or File (via associated List Item) or Folder (via associated List Item) there is a common approach that you could consider: ...
16 votes
Accepted

get current user info using jquery ,REST and csom

SP Foundation does not include the User Profile Service, as @Aveenav noted. Therefore you probably do not have access to the REST endpoints for that service. Instead you will have to use the user ...
  • 5,720
16 votes

The length of the URL for this request exceeds the configured maxUrlLength value. REST API

In case it helps, we had a similar (but not exact-same) situation. The URL parameters are not included in the length-restriction (at least not this restriction), so we changed our URL to be like so (...
  • 161
16 votes

Check users group membership via REST API using AD-Groups in SP-Groups

At least there is a workaround that will work fine (although I don´t like workarounds). You can set the group setting "Who can view the membership of the group" in SP-Group-Settings to "Group Members"....
  • 679
16 votes
Accepted

REST to get list item by Id

Try this (Excerpt from here): function getListItem(url, listname, id, complete, failure) { // Getting our list items $.ajax({ url: url + "/_api/web/lists/getbytitle('" + listname + "')...
  • 12.2k
15 votes

Paging using REST/OData with SP 2013

Currently $skip query option is not supported in SharePoint 2013/Online. According to Use OData query operations in SharePoint REST requests: The $skip query option does not work with queries for ...
15 votes
Accepted

Is it possible to create a Document Set using REST API

How to create a Document Set using SharePoint REST Interface The following example demonstrates how to create a Document Set in SharePoint 2013: function getListUrl(webUrl,listName,success, error) {...
15 votes
Accepted

Distinguish between approved and not approved items (REST api)

Try using OData__ModerationStatus if you're using the _api endpoints in 2013. 0 = Approved, 1 = Rejected, 2 = Pending, 3 = Draft So you would use a URL ending with an OData filter command like: "......
  • 5,880
14 votes

SharePoint 2013 REST-API: Reliable way to retrieve all field values of a list item?

How about a simple query: /_api/web/lists/getbytitle('<list title>')/items(<item id>) which will return all the field values for a list item with some limitation for User/Lookup fields: ...
14 votes
Accepted

REST: Filter List Items by Content Type Name

Found a way which works for me. SharePoint 2013 on-prem. Starting point: A document library with two content types Document & Highlight Report and two documents in it for testing purpose. REST ...
  • 3,167
14 votes
Accepted

SharePoint Online REST API - Get List selecting all fields excluding one

Like I mentioned in my comment, a simple workaround would be to traverse through the json results and delete the Title for each var call = $.ajax({ url: "http://<site url>/_api/web/lists/...
  • 12.2k
13 votes

REST query cannot be viewed in Internet Explorer

To open REST API Query url http://server1/sites/mysite/_api/web/lists/getByTitle('list title') in browser like internet explorer Goto Internet Options -> Content->Feeds and Web Slices->Settings-> ...
  • 467
13 votes

Getting document name using REST (not title) while filtering document library

FileLeafRef: /_api/web/lists/getByTitle('list')/items?$select=FileLeafRef File Name: /_api/web/lists/getByTitle('<list title>')/items?$select=File/Name&$expand=File Also, for querying a ...

Only top scored, non community-wiki answers of a minimum length are eligible