SharePoint 2013 Online GetListItems using SPServices

This SharePoint Online tutorial, we will discuss how we can retrieve list items by using SPServices GetListItems method in SharePoint Online office 365. Retrieve list items using SPServices in SharePoint 2013/2016/Online.

If you are new to SharePoint SPServices, then read an article on Working with SPServices in SharePoint 2013/2016/Online.

In this SPServices SharePoint 2013 example, I have a list which has 5 items and I am trying to displaying those 5 items in a page with a hyperlink. So if someone clicks on the item and S/He should able to see the item.

Edit the page and Put the below code in a script editor web part in SharePoint Online. Read Script Editor web parts in SharePoint 2016/2013/Online.

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>
<script type=”text/javascript” src=”//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices.min.js”></script>

<script type=”text/javascript” language=”javascript”>

$(document).ready(function() {
GetAllListItem();
});
function GetAllListItem()
{
$().SPServices({
operation: “GetListItems”,
async: false,
listName: “TestList”,
CAMLViewFields: “<ViewFields><FieldRef Name=’Title’ /><FieldRef Name=’ID’ /></ViewFields>”,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode(“z:row”).each(function() {
var link=”https://onlysharepoint2013.sharepoint.com/Lists/TestList/DispForm.aspx?ID=”+$(this).attr(“ows_ID”) ;
var liHtml = “<li><a href='” + link + “‘ target=’_blank’>” + $(this).attr(“ows_Title”) + “</a></li>”;
$(“#TestListItems”).append(liHtml);
});
}
});
}
</script>

<ul id=”TestListItems”/>

It will appear like below:

SharePoint 2013 Online GetListItems using SPServices

SharePoint 2013 Online GetListItems using SPServices

You may like following SPServices SharePoint 2013/2010 tutorials:

Hope this SharePoint SPServices example explained how to retrieve list items using SPServices in SharePoint 2013/2016/Online and bind as hyperlink.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

>