Posts

Showing posts with the label REST

SharePoint REST - get more than 100 list items

Since SharePoint 2013 you can use REST calls to get or set data. But if you firing a call against a list with 101 items you will get only 100. The cause is based at the REST interface. To reduce server overload the result is limited - it is called server paging. That is pretty smart, but what if you need all results? There are two ways of solving this problem. The first and easy one is to set the $top flag. So you add ?$top=101 to your REST call and you will get all 101 items. This works fine until you have 102 items.

SharePoint 2013 apps - communicate with host SharePoint without using SP.RequestExecutor

In a previous post  I wrote an app to read and write data from the Host-SharePoint. To do this I made use of the SP.RequestExecutor. This class is used to get the permissions for reading and writing data into the Host-SharePoint. But there is a way to skip the authentification and using the URL directly. This makes your code much more beautiful and easy to read. All you need to do is to call a function (_spPageContextInfo.siteAbsoluteUrl). That function returns an URL and makes it possible to communicate with the SharePoint per JSOM and REST.  I also tried to call the URL with the function and make a context with another URL and this does not work. Even the Host-URL does not work. Another disgusting point is that the URL, which is returned by the function, is that it not contains the URL of the app and not of the host. It is a 'hybrid' that begins like the app URL, but ends earlier. 1 2 3 4 var url = _spPageContextInfo.siteAbsoluteUrl; context = new SP.ClientContext(u...