Friday, May 20, 2016

how to get current sharePoint user department using javascript/spservices

<script src="/Scripts/jquery-1.10.2.min.js" type="text/javascript"></script>  
<script src="/Scripts/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>  
<script language="javascript" type="text/javascript" src="/Scripts/jquery.SPServices-0.7.2.min.js"></script>

<script language="javascript" type="text/javascript" src="/Scripts/sputility.min.js"></script>


<script type="text/javascript">  

$(document).ready(function() {  
    // get the title of current user  
    var UserName= $().SPServices.SPGetCurrentUser({  
    fieldName: "Title",  
   debug: false  
});  
// get department of current user
var userDepartment = $().SPServices.SPGetCurrentUser({
   fieldName: "Department"
   });
   




});  

</script>

No comments:

Post a Comment