I'm developing an Infopath form. I'd like to only use a webservice if possible.
Of course with code I can tap right into AD. But not what I need for this project.
I'm looking around I've check out
- /_vti_bin/usergroup.asmx
- /_vti_bin/userprofileservice.asmx
What webservice will get me the users phone number... not the current user...
but a user I've selected from a menu selection.
I've been searching through:
http://msdn.microsoft.com/en-us/library/dd878586(v=office.12).aspx
When I try this:
var accountName = "LayEN";
var propertyName = "PreferredName";
var soapEnv =
"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:tns='http://schemas.microsoft.com/sharepoint/soap/'> \
<soap:Body> \
<GetUserProfileByName xmlns='http://microsoft.com/webservices/SharePointPortalServer/UserProfileService'> \
<AccountName>" + accountName+ "</AccountName> \
</GetUserProfileByName> \
</soap:Body> \
</soap:Envelope>";
$.ajax({
url: "/_vti_bin/userprofileservice.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset='utf-8'"
});
function processResult(xData, status) {
console.log (xData.responseXML);
$(xData.responseXML).find("PropertyData > Name:contains('PreferredName')").each(function() {
if($(this).parent().find("Values").text().length > 0)
$("#list").append('<li>' + $(this).parent().find("Values").text() + '</li>');
});
}
I get this error:
soap:ClientA user with the account name Windows2000\LayEN could not be found. ---> An error was encountered while retrieving the user profile.UserCannotBeFoundAn error was encountered while retrieving the user profile.