Tuesday, September 24, 2013

jQuery spservices to get current user name for sharepoint site

Hi peeps,
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>


Hope this helps...
RELATED Post : How to display user information using ProfilePropertyLoader in sharepoint

No comments:

Post a Comment

Popular Posts