Wednesday, October 28, 2015

How to get user information using SharePoint SPServices/Webservices

 We have access to account IDs.
For Example:

var userId=12;

No access to user names.



var userId=12;
$().SPServices({
     operation: "GetListItems",
     listName: "User Information List",
     CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + userId + "</Value></Eq></Where></Query>",
     CAMLRowLimit: 1,
     completefunc: function (xData, Status) {
         var userDetail = {};
         var row = $(xData.responseXML).SPFilterNode("z:row").get(0);
         userDetail .Name = $(row).attr("ows_Name");
         userDetail .Title = $(row).attr("ows_Title");
         userDetail .Email = $(row).attr("ows_Email");
         result(userDetail );
     }
  });

No comments:

Post a Comment