SPServices in SharePoint 2013/2016/Online

In this SPServices SharePoint 2013 tutorial, I will explain What is SPServices in SharePoint 2013? How to download and use SPServices in SharePoint 2013/2016 or SharePoint Online. Also, we will see an example using SPServices in SharePoint 2013.

SPServices in SharePoint 2013

SPServices is a jQuery library which abstracts SharePoint’s Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.

You can use it with MOSS 2007, SharePoint 2013 and SharePoint 2013 as well as with Office 365 (SharePoint online).

Thanks a lot to the author Sympmarc for sharing this.

To use this js file, you can download the js file from the GitHub URL and save to your SiteAssets library.

Then you can write the below code in a script editor web part in SharePoint 2013/2016/Online. If the reference is correct and SPServices is getting called properly then it should display the site URL properly.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="https://win-pfcp2dgt8di/sites/EnjoySharePoint/SiteAssets/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {

The above SPServices SharePoint 2013 example should alert current site URL.

Retrieve Manager name using SPServices in SharePoint

This spservices tutorial explains how to populate or retrieve the manager’s name using SPServices in SharePoint 2013/2016 or SharePoint Online.

Retrieve Manager name using SPServices in SharePoint

Recently I got a requirement where I need to retrieve the manager name using the client object model code in SharePoint. Thanks, Sagar for giving the code sample.

Here we will discuss how we can get the Manager name using SPService.

Here we need to give reference to the SPService.js file which you can download from this GitHub URL. And also we need to give the jQuery reference.

Then you can add a script editor web part to the page and add the below code in it.

<script type="text/javascript" src="https://win-pfcp2dgt8di/sites/EnjoySharePoint/SiteAssets/jquery-1.3.2.min.js">
<script type="text/javascript" src="https://win-pfcp2dgt8di/sites/EnjoySharePoint/SiteAssets/jquery.SPServices-0.4.8.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var managerName;
var userName = $().SPServices.SPGetCurrentUser();
operation: "GetUserProfileByName",
async: false,
AccountName: userName,
completefunc: function (xData, Status) {
managerName = $(xData.responseXML).text();
var managerLength = managerName.length;
var indexofManager = managerName.indexOf("Manager");
managerName = managerName.substring(indexofManager + 13, managerLength);
var indexOffalse = managerName.indexOf("false");
managerName = managerName.substring(0, indexOffalse);


Once you will save the page, it will display first display the user name and then the manager name in the alert box.

You may like following SPServices SharePoint 2013/2010 tutorials:

Hope this will be helpful to know SPservices in SharePoint 2013, how to use SPServices in SharePoint 2013/2016/Online.

Also, we saw an example of how to retrieve current site URL using SPServices in SharePoint 2013. And, we saw how to retrieve Manager name using SPServices in SharePoint.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.