Skip to main content

Posts

Showing posts with the label REST

How to filter SharePoint list Based in Date Time related functions in SharePoint 2013 using REST/ODATA

REST queries are quiet familiar when you are working with SharePoint Apps and SharePoint development. I have found quiet difficult to pass the Date Time parameter to REST and took few minutes to figure that out. There are two ways to end points to access list data. http://<SharePoint Url>/_api/web/lists/getbytitle('Pages')/items? http:// <SharePoint Url>/_vti_bin/listdata.svc And these functions are working only on listdata.svc These are few example of REST queries which uses Created Column as a sample field.   Filter using day () function http:// <SharePoint Url>/_vti_bin/listdata.svc/<listname>?$filter = day(Created) eq 2   Filter using month () function http:// <SharePoint Url>/_vti_bin/listdata.svc/<listname>?$filter = month (Created) eq 2   Filter using year () function http:// <SharePoint Url>/_vti_bin/listdata.svc/<listname>?$filter = year (Created) eq 2   Filter using hour () function http:// <...

How to filter SharePoint list Based in Date Time in SharePoint 2013 using REST/ODATA

REST queries are quiet familiar when you are working with SharePoint Apps and SharePoint development. I have found quiet difficult to pass the Date Time parameter to REST and took few minutes to figure that out. These are few example of REST queries which uses Created Column as a sample field. Filter Greater than Date http://<sharepointurl>/_api/web/lists/getbytitle('Pages')/items?$filter=Created gt dateTime '2017-03-03T00:00:00Z' Filter Less than Date http://<sharepointurl>/_api/web/lists/getbytitle('Pages')/items?$filter=Created lt dateTime '2017-03-03T00:00:00Z' Filter Equal Date http:// <sharepointurl>/_api/web/lists/getbytitle('Pages')/items?$filter=Created eq dateTime '2017-03-03T00:00:00Z' Filter Between Dates http:// <sharepointurl>/_api/web/lists/getbytitle('Pages')/items? $filter=( Created gt dateTime '2016-03-03T00:00:00Z' and Created lt dateTime'2017-03-03T00:00:00Z...

SharePoint 2013 List Operations in REST– Retrieve List Fields Basics

How to make a REST call in SharePoint App and SharePoint Provider Hosted App – Part 1 SharePoint 2013 List Operations in REST– Retrieve List  Fields Basics – Part 2 You can use the function specified in the first post to call the REST URLs. You can use the appropriate function depending on the App type you are developing. Get selected fields in SharePoint List using SELECT REST operation. Getting single value fields /* List Name : listname Columns: Title => Text , ID => Number */   var url = "/_api/web/lists/getbytitle('listname')/items?$select=Title,ID" ;   function s(data){   // get the data and convert to JSON Objects var d = JSON.parse(data.body).d.results[0]; alert(d.ID); alert(d.Title); }   function f(data){ alert(data); }   getREST(url,s,f); Getting Single value Lookup fields /* List Name : listname Columns: ID => Number , CountryLookup => List LooukUp */   var url = "/_api/web/lists/get...

REST operations in SharePoint 2013

REST operations are essential in any SharePoint development. This series explain available REST endpoints in SharePoint 2013. First article shows how we can made a REST call in both SharePoint Hosted and Provider Hosted app. How to make a REST call in SharePoint App and SharePoint Provider Hosted App – Part One SharePoint 2013 List Operations in REST– Retrieve List  Fields Basics – Part 2 Executing a REST GET call from SharePoint Provider Hosted App First you need to refer related JavaScript related. <script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" ></script> <script type= "text/javascript" src= "#SPWeb/_layouts/15/MicrosoftAjax.js" ></script> <script type= "text/javascript" src= "#SPWeb/_layouts/1033/init.js" ></script> <script type= "text/javascript" src= "#SPWeb/_layouts/15/sp.core.js" ></script> <script type= "text/j...

How to open Documents in Office Web Apps in SharePoint apps (Provider Hosted and SharePoint Hosted)

Office web apps are now getting more and more popular with the SharePoint 2013 environment. In native SharePoint environment when you click on a document it will open in a office online (OWA) based on configuration. But it you a writing a SharePoint Hosted app or a Provider Hosted app; you might wonder how to open it in office web apps and what is the URL you are going to use it. You can use JSOM and SharePoint REST services to archive this. Frist you need to send a REST request by mentioning file name. url: AppWebUrlUrl + "/_api/web/GetFileByServerRelativeUrl('server relative file name')" , method: "GET" , contentType: "application/json;odata=verbose" , headers: { "Accept" : "application/json; odata=verbose" } You should carefully give the sever relative file name for this operation. regardless of app type (Provider hosted or a SharePoint Hosted ) file name it coming with app web url Ex: Absolute File Url https://oapp-bfb...