Hot answers tagged

7

unfortunately, afaik (& tested) the REST services are only working for authenticated users. You'll need to create a bridge service calling with credentials the native ones if you want to provide that functionality but since you're authenticating your request, are you sure it's not an authentication issue ? Does the target username / password combination ...


7

Yes, you can expand multiple columns: /_api/web/lists(guid'<guid>')/items?$select=Title,LookupField1/FieldToBeExpanded1,LookupField2/FieldToBeExpanded2&$expand=LookupField1,LookupField2


7

Date and time OData functions: day() month() year() hour() minute() second() does not seem to work with SharePoint 2013 REST Service Error: The query is not valid But you could consider the following approaches. Option 1 Utilize SharePoint 2010 REST endpoint: /_vti_bin/listdata.svc/ListName?$filter=month(<DateColumn>) eq <MonthNumber> ...


6

This took forever to figure out, but of course it is simple once you got it. Instead of pasting a bunch of code, here is the context and then the raw HTTP POST request that I ended up with. The documentation is actually right here: http://msdn.microsoft.com/en-us/library/dd962796(v=office.12).aspx Syntax for the slug header is as following: /<...


6

According to Use OData query operations in SharePoint REST requests, Grouping is not supported. The solution, is to apply grouping for the JSON results returned from REST endpoint. Example Suppose the following function is used for getting list items via SharePoint REST API: function getListItems(url, listname, query, complete, failure) { $.ajax({ ...


6

In order to select User or Lookup field values the $expand operator is used (for making a projection of AnnouncedBy column with User Information List). For example, the following query https://contoso.sharepoint.com/news/_api/web/lists/getByTitle('Announcements')/items?$select=*,AnnouncedBy/Title&$expand=AnnouncedBy will return the following result: ...


5

Choice fields are returned with a Value without the need for expansion: Example: IP_WorkflowStatus = IP_WorkflowStatusValue Here is an example of a query without using expansion: $filter=IP_WorkflowStatusValue eq '2-Validated' If you want to use expansion, then you need to use expanded field notation Relation/Field: $filter=IP_WorkflowStatus/Value eq '...


5

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 SharePoint list items. But you could utilize $skiptoken query option to return paged results as demonstrated below. Format: $skiptoken=Paged=TRUE&...


5

As far as I know it is not supported to apply $filter or $select expression for the endpoint: http://<sitecollection>/<site>/_api/web/lists(listid)/getItems(query) To summarize: CAML and OData query could not be combined. From another hand, since expanding of User Fields is not supported in CSOM/REST i would suggest to construct your ...


5

Unfortunately SharePoint REST API does not support OData V4 at the moment. You could determine the current version of OData version by executing metadata query: Url: https://server/_api/$metadata Method: Get The specified query returns against SharePoint Online DataServices m:DataServiceVersion="3.0" which corresponds to OData V3


4

You will need the Id of the Employee whose children you want to fetch. Syntax: https://[My SharePoint]/_api/web/lists/MyList/items?$select=ChildName&$expand=FieldValuesAsText/Employee&$filter=Employee eq 1 This will return the 'ChildName' field of all items in which the user with Id 1 occurs in the 'Employee' field Update: For getting the Id of ...


4

You are missing ID in expand. The query should look like: _api/Web/Lists(guid'id')/items?$select=Id,Author/ID&$expand=Author/ID&$filter=(Author/ID eq 21)


4

Having worked with & built similar stacks for extending/integrating SharePoint with external LOB systems, I can say our approach has been to attack it from the other end. That is, rather than trying to use the BCS to connect to an on-prem DB, we'd create a RESTful WCF service that ran on-prem alongside the DB (could be OData as well if based off a ...


3

I have various parameters for testing ODATA API And have tested: "_api/Web/Lists/getByTitle('Documents')/itemcount" result: Is equivalent of "_vti_bin/ListData.svc/Documents/$count" the result is fast and immediate: with this "/_vti_bin/ListData.svc/listname?$inlinecount=allpages" add to result as field called "count", see image below: You can ...


3

The $skip parameter does not work in SharePoint 2013 for list items. It only works for collection of data (like list collections, ecc..). See my comment at the end of this article: http://msdn.microsoft.com/library/d4b5c277-ed50-420c-8a9b-860342284b72.aspx


3

I see the same issue on SP2013 online with the new OData V3 _api endpoint. For CRUD operation it might be better to use the OData v2 listdata.svc endpoint for the time being.


3

It is not supported for multiselect fields (i.e. fields represented in the normal UI as check boxes). The following quote is for 2013 but the same rules apply for the ListData.svc. You can filter on the client side, though, depending on how you represent the data and the controls you use. Queries for multi-value lookup fields and users Because ...


3

The following SharePoint REST query could be used to retrieve content type names and accompanying field names: /_api/web/contenttypes?$select=Name,Fields/InternalName&$expand=Fields/InternalName


3

Try adding following in the URL $select=AnnouncedBy/Id,AnnouncedBy/Title,*&$expand=AnnouncedBy Reference: SharePoint 2013–retrieving the lookup value of User fields using the REST API Getting User Information with the SharePoint 2013 REST API


3

You can get ID of newly created item in success function which you can use later. Please refer below success function : function CreateListItemWithDetails(listName, webUrl, newItem) { var item = newItem; return $.ajax({ url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items", type: "POST", ...


2

Unfortunately, the REST API with Javascript will not give you the recurring calendar items. If you want to retrieve the recurring calendar items with client side code, you need to take a look at SPServices: http://spservices.codeplex.com/ Take a look at this thread: http://spservices.codeplex.com/discussions/254560


2

You can disable the Access permission to remote interfaces to the anonymous users, follow this: Navigate to the site (or sub-site) where you wish to enable anonymous access. Go to Settings - Site settings. Under Users and Permissions, click on Site Permissions. Under the Permissions tab, click on Anonymous Access. Choose whether you want ...


2

Vadim's response is very close, but his query string is off a bit. The issue isn't really his, its Microsoft's as they are not being consistent with their URI escaping. I used the Postman extension for Chrome and by examining the __next value returned when using $top (which is alternative approach worth considering) I noticed that there is an ampersand ...


2

When updating a list item you should use the uri from the metdata of the list item you want to edit results[i].__metadata.uri. $(document).ready(function () { var defaultClient = OData.defaultHttpClient; var spClient = { request: function (request, success, error) { request.headers = { "Accept": "application/json;odata=verbose", ...


2

You could also filter fields by SPField.CanBeDeleted property in order to get the list of questions from a Survey List How to get the list of questions from a Survey List via REST API /_api/Web/Lists/getByTitle('Survey')/fields?$filter=(CanBeDeleted eq true)


2

Remove the "eq true" from your query. http://server/site/subsite/_api/Lists/getbytitle('SomeList')/items?$filter=startswith(Title, '[%Variable: StringToMatch%]')


2

According to OData specification: The syntax of a $expand query option is a comma-separated list of Navigation Properties. Additionally each Navigation Property can be followed by a forward slash and another Navigation Property to enable identifying a multi-level relationship. In your example, List Item resource does not expose RootFolder ...


2

The syntax of your query seems correct. Most probably this error occurs since $select and $expand operators are case-sensitive. Try the following query: /_api/web/lists/getByTitle('Customer')/items?$select=Parent/Title&$expand=Parent


2

Issue got resolved after updating the SQL 2012 Server(PowerPivot) version to SP1 and changing the account for SQL Server Analysis Services (PowerPivot) to Local System account. Also, the service account used for the Excel Services Application needs to be set as an Analysis Services administrator. MSDN reference link


2

Since AssignedTo is a multi-user field, you'd receive an array. You can then loop into the array and receive specific properties such as title or id. Make sure the properties are in the $select. See the example below: var call = $.ajax({ async: false, url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('Tasks')/items" + "?...



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