Search This Blog

Friday, November 27, 2015

jQuery spservices to get current user name for sharepoint site

In this post we are going to write a script which will give us the current user loggedin name for a sharepoint site using jQuery SPServices.

Below is the script:

// add the ref of jQuery file
<script type="text/javascript" src="/style library/jquery-1.7.2.js"></script>
// add the ref of jQuery SPServices file
<script type="text/javascript" src="/style library/jquery.SPServices-0.7.0.min.js"></script>
<script type="text/javascript">
var currentuserName = $().SPServices.SPGetCurrentUser({
fieldName: "Title",
debug: false
});
</script>

No comments:

Post a Comment