SPServices.SPGetCurrentUser can only get ID

I want to get current user information using SPServices.SPGetCurrentUser, however, it can only get ID, the Name and other Fileds are always null.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="../Code/jquery.SPServices-0.7.2.js"></script> <script type="text/javascript"> $(function() { var thisUserID = $().SPServices.SPGetCurrentUser({ fieldName: "ID", debug: false }); alert("ID: "+thisUserID);

var thisUserAccount = $().SPServices.SPGetCurrentUser({ fieldName: "Name", debug: false }); alert("Name: "+ thisUserAccount); }); </script>


Can you tell me the reason and how to resolve it?




June 19th, 2015 3:00am

Dear all,

I only want to use spservice to get current user information using the code above.

Can you tell me why it don't work?

Thanks,




Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 3:24am

Hi Jerry,

I can login the site sucessfully, so I have the title or Name.

However, I can only get the ID.

I'm using SharePoint 2010 not 2013.

Does it have permission setting to limite the spservice?

In other word, I'm site admin. Is it the permission issue to use spservice?

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../Code/jquery.SPServices-0.7.2.js"></script>

<script type="text/javascript">

$(function() {  
  
        alert(1);
	
        var thisUserID = $().SPServices.SPGetCurrentUser({
		fieldName: "ID",
		debug: false
	});
        alert("ID: "+thisUserID);
        var thisUserAccount = $().SPServices.SPGetCurrentUser({
   fieldName: "Title",
   debug: false
  }); alert("Title: "+ thisUserAccount); alert(3); }); </script>

Thanks




June 24th, 2015 2:44am

Hi,

In my SharePoint 2010 environment, the code snippet above still work as expected.

And the SPService is running as the current logged in user, if the user permission is valid, it should work.

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
June 30th, 2015 2:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics