This project has moved. For the latest updates, please go here.



Web Service





Here's an example provided by StefanBauer. Thanks!

To search Principals the following code works:

  operation: "SearchPrincipals",
  webURL: "/",
  searchText: "bauer",
  maxResults: 100,
  SPPrincipalType: "SPPrincipalType.User",
  completefunc: function (xData, Status) {

Last edited Nov 29, 2012 at 3:29 AM by sympmarc, version 2


supadupdip May 4, 2015 at 2:34 PM 
sort of answered my own question:

var myArray = [];
operation: "SearchPrincipals",
webURL: "/",
async: false,
searchText: "Smith",
maxResults: 1000,
//SPPrincipalType: "SPPrincipalType.User",
principalType: "All",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("PrincipalInfo").each(function() {
var info = {};
info.accountName = $(this).find('AccountName').text();
info.userInfoID = $(this).find('UserInfoID').text();
info.displayName = $(this).find('DisplayName').text(); = $(this).find('Email').text();
info.department = $(this).find('Department').text();
info.title = $(this).find('Title').text();
info.isResolved = $(this).find('IsResolved').text();
info.principalType = $(this).find('PrincipalType').text();
}//end of completefunc
});//end of SPServices

supadupdip May 1, 2015 at 9:44 PM 
Is there anything in SPServices that would be able to help you parse this out? Right now the response is just nested XML so Z:row filtering wouldn't work. Is there another way to be able to get this data into a proper format that can be usable with jQuery?

Rotruck Apr 22, 2013 at 5:28 PM 
When using the example by StefanBauer, I noticed that I was only getting back users. After some debugging I realized that the principal type was not being passed correctly and was always using the default "User". I had to change SPPrincipalType: "SPPrincipalType.User" line to principalType: "User". I was then able to use the [None | User | DistributionList | SecurityGroup | SharePointGroup | All] options.