User ID using SPServices

May 31, 2012 at 7:06 PM
Edited May 31, 2012 at 7:08 PM

I have created a custom list using Sharepoint 2007. I have the fields country and region in the form.  I would like to pull the customers information with out them having to enter their information. The custom list automatically pulls this information through. I am currently using getlistitems and getcurrentuserinformation. This is great but it pulls the current user that is looking at the page. This is what I want but I want it to show the information of the person that filled out the form.  because I need to access the users ID, name, and Title. What type of call do I need to make to pull their information? Getlistitems will not let you pull this information. What will. I would appreciate your help on this.

This is my code so far and it works, but only pulls the current user information. I need the person's information that filled out the form!!

<script type="text/javascript" src=".../js/jquery-1.7.2.min.js"></script><script type="text/javascript" src=".../js/jquery.SPServices-0.7.1a.min.js"></script><style type="text/css">.list{ list-style:none; height:15px; float: left; width:175px;        font-size:12px;}.container { padding:5px; width:260px; float:left; height:150px;}
.image { width:65px; height:80px; float:left;}
</style><html><ul id="tasksUL"></ul></html>
<script language="javascript" type="text/javascript">$(document).ready(function(){var thisUserID = $().SPServices.SPGetCurrentUser({ fieldName: "ID", debug: false});alert(thisUserID);
$("input[Title='Name']").val(thisUserID);
var loginUser = $().SPServices.SPGetCurrentUser({        fieldName: 'Name',        debug:false});          
 var thisUserAccount = $().SPServices.SPGetCurrentUser({ fieldName: "Name", debug: false});alert(thisUserAccount);
$("input[Title='Name']").val(thisUserAccount);  
 var thisFNAccount = $().SPServices.SPGetCurrentUser({ fieldName: "Title", debug: false});$("input[Title='Name']").val(thisFNAccount);   alert(thisFNAccount);

 $().SPServices({  operation: "GetListItems",  async: false,  listName: "{......}",  CAMLViewFields: "<ViewFields><FieldRef Name='Region' /><FieldRef Name='Country' /><FieldRef Name='Introduction' /></ViewFields>",     completefunc: function (xData, Status) {
   alert("Sending the xml request to the server was: " + Status);   alert("Sharepoint processing of the message returned: " + xData.responseText);

   $(xData.responseXML).SPFilterNode("z:row").each(function() { var splitYes = $(this).attr('ows_Introduction');
 var liHtml ='<div class="container"><div class="bioBG" onclick="javascript:SPNGES.Paris.ViewMiniProfile(event, {parentElement:this, '+$(this).attr("login")+' : '+$(this).attr("profile")+'});"><li class="image"><img src=".../image.user.root.nges?username='+ thisUserAccount +'"</li><li class="list"><a href=".../userdisp.aspx?ID='+ thisUserID +'" > '+ thisFNAccount +' </a></li><br> <li class="list">Region: '+$(this).attr('ows_Region')+' </li><br> <li class="list">Country: '+$(this).attr('ows_Country')+'</li></div>';if (splitYes != 'No'){
        $("#tasksUL").append(liHtml);}      });    }  });});</script>

Coordinator
Jun 1, 2012 at 4:11 AM

To some degree, it depends on the license of SharePoint you are using. If it's MOSS or SharePoint 2010 (not Foundation), then you can call the User Profile Service.

M.