GetListItems Returning Names instead of Usernames

Apr 2, 2012 at 10:57 PM

This may be by design, but I am having trouble figuring out a work around.

Background:

I have a list with various fields including People and Groups columns.  The data needs to be displayed from this list and on the People and Groups Columns, I would like to look-up additional data for the value (i.e. Email, Phone, Title).

Issue:

I am able to successfully able to get a filtered dataset by using GetListItems. However, in the People and Groups columns I am only recieving "ID#;DisplayName" as a result.  From what I recall, there is only a way to do a user profile lookup by GUID, Name or Email.  So, I have no way to find the additional profile properties.

Sample Code:

$().SPServices({

	webURL: "http://sharepointsite/",
	operation: "GetListItems",
	async: false,
	listName: "Projects",
	CAMLQuery:"<Query><Where><BeginsWith><FieldRef Name='ProjectURL'/><Value Type='URL'>" + currentPathName + "</Value></BeginsWith></Where></Query>",
	CAMLViewFields: "<ViewFields><FieldRef Name='ID' /><FieldRef Name='ProjectURL' /><FieldRef Name='Business_Lead' /></ViewFields>",
	completefunc: function (xData, Status) {
		$(xData.responseXML).SPFilterNode("z:row").each(function() {
			lookupUserData($(this).attr("ows_Business_Lead")));
	}
});

Solution:

Basically, I am looking for a way to change the GetListItems call to return an Email, GUID or Username value OR to find a way to lookup the profile data by using only a first and last name.  I know there is a method that you can use the Index number, but that does not appear to be a dependable source.

Thoughts?

Apr 3, 2012 at 12:12 AM

You should take a look a the documentation for the available services that this module facilitates.

You are correct in that the information you are looking for on the user will not be found in the output of GetListItems... however, you can use the value found in the output from GetListITems (for each row) and use the SharePoint GetUserProfileByName operation (under the UserProfileService service) to get the full details of that user... including all the data items you highlighted.  I do that today to display information about user's that are defined on list rows.

If you don't have SharePoint and you are working with WSS, then see if any of the operations in 'Users and Groups' can fill your need...

Paul.

Apr 3, 2012 at 4:28 PM

Paul --  Thanks for the quick reply.

I had looked at the GetUserProfileByName service, but am unable to get it to return results when I use anything other than the AD account to query.  For example, when using "First Last" or "email@domain.com" it will will fail with the standard "A user with the account name could not be found", but when I use  "DOMAIN\username" it will return records.  Based on your feedback, I presume that all three of those queries should work?  So, is there something incorrect with the Profile service that was setup at this office?

Apr 3, 2012 at 5:23 PM

I was responding to your "business" requirement of

"The data needs to be displayed from this list and on the People and Groups Columns, I would like to look-up additional data for the value (i.e. Email, Phone, Title)."

but now I have a feeling you are hiding another requirement somewhere :)

My assumption is that the 'Business_Lead' column in your 'Projects' list is a People field... which means that it stores the DOMAIN\user for each row... From your code example above, you are already passing that over to a function called lookupUserData()... the code inside that function should be able to use GetUserProfileByName and the input value to get the full details on the user.

 

There is another service you can use to query for people...the SearchPrincipals operation under the People service... (I currently use this in combination with jQuery-UI Autocomplete plugin to give user's "type-ahead" functinoality for picking users)

Here is an example

 

$().SPServices({
    operation:      "SearchPrincipals",
    searchText:     "your search term here... example: last name only",
    async:          true,
    completefunc:   function(xData, status){
        $(xData.responseXML).find("PrincipalInfo").each(function(){
            //your code here... Example.. take teh DOMAIN\user information and call GetUserProfileByName to get full detail.
        });
    }
});

I don't remember now how much details in on the response... you may need to call GetUserProfielByName to get more information about each user.

 

 

Paul.

 

Apr 3, 2012 at 7:20 PM
ptavares wrote:

My assumption is that the 'Business_Lead' column in your 'Projects' list is a People field... which means that it stores the DOMAIN\user for each row... From your code example above, you are already passing that over to a function called lookupUserData()... the code inside that function should be able to use GetUserProfileByName and the input value to get the full details on the user.

 

This is where my issue lies.  Yes, the Business_Unit field is a "Person or Group" field.  However, the data that is being returned is not in the format: "ID;#DOMAIN\Username", but the field is returning as "ID;#DisplayName".  For example I am getting  "135;#Jon Doe" instead of "135;#CORP\jdoe".  

Now, based on your second comment, I am able to search for a user with the SearchPrincipals method to get the AD account name (Domain\Username) that I can use with the original GetUserProfileByName call.  While this works, I was hoping to not have to run multiple calls to get this information.  But if that is all we can do, then I guess that is what I have to use.

Apr 3, 2012 at 7:49 PM

Thank you for the clarification... Based on that I did a quick check and I admit that I miss spoke on how a User value is represented in a People column.. You are correct... I just checked my implementation and I am doing just that (double call) to get the user information... I don't remember now if I checked this out, but maybe one of the other methods under the UserProfileService can help? (maybe one where you can use the index? since you have that from the list column value)

In particular, the GetUserProfileByIndex is perhaps the one... but in a quick test, I'm unable to make it work...  Maybe Mark can she some light on the usage of that operation.

Mark: looks like the message is constructed with out an index when I use it this way:

$().SPServices({
	operation: "GetUserProfileByIndex",
        index: "318",
	completefunc: function (xData, Status) {
            //do something.
	}
});

Request:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserProfileByIndex xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"></GetUserProfileByIndex>
</soap:Body>
</soap:Envelope>
As you can see.... there is no INDEX in the envelope... Bug?

Response:

<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">
    <soap:Body>
        <soap:Fault>
           <faultcode>soap:Server</faultcode>
           <faultstring>Server was unable to process request. ---&gt; This operation requires you to be managing your own data or have administrator privileges.</faultstring>
           <detail></detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

Paul

 

Apr 3, 2012 at 10:01 PM

I had experienced the same errors when using GetUserProfileByIndex as well.  So, not sure what is going on.  However, after looking through some other posts about that service specifically, it appears that it is not the most reliable source to use.  As a result, I think I am going to have to live with the double call since it will be more reliable source.  

Marc blogged about it here:

http://sympmarc.com/2011/06/25/confusion-about-the-userprofile-web-services-getuserprofilebyindex-operation/

My updated code logic is here (which functions successfully).  Thanks for your help in getting me to a solution, though the ideal solution seems not feasible.

function formatPerson(value)
{
	var element = checkUndefined(value);
	return element.substr(element.indexOf(';#')+2,element.length)
}

function formatPersonID(value)
{
	var element = checkUndefined(value);
	return element.substr(0,element.indexOf(';#'))
}


function searchPrincipalData(searchText, userID) {
	//searchText: Any text value to search user profiles
	//userID: Sharepoint internal account ID number
	var principal = {};
			    
	var params = {
		operation: 'SearchPrincipals',
		async: false,
		completefunc: function (xData, Status) {
			$(xData.responseXML).SPFilterNode("SearchPrincipalsResult").each(function() {
				$(this).SPFilterNode("PrincipalInfo").each(function() {
					if ((userID) && ($(this).find("UserInfoID").text() == userID)) {
						principal.AccountName = $(this).find("AccountName").text();
						principal.UserInfoID = $(this).find("UserInfoID").text();
						principal.DisplayName = $(this).find("DisplayName").text();
						principal.Email = $(this).find("Email").text();
						principal.Department = $(this).find("Department").text();
						principal.Title = $(this).find("Title").text();
					}
				});
			}); // end each
		} // end completefunc
	};
		    
	if (searchText!= null) {
		params.searchText = searchText;
	};
		    
	$().SPServices(params);
			
	return principal;
}

function getUserDataFromColumnValue(value)
{
return searchPrincipalData(formatPerson(value),formatPersonID(value));	
}


$().SPServices({
		webURL: "http://sharepoint/",
		operation: "GetListItems",
		async: false,
		listName: "Projects",
		CAMLQuery:"/ma/prot",
		CAMLViewFields: "",
		completefunc: function (xData, Status) {
			
			
			$(xData.responseXML).SPFilterNode("z:row").each(function() {
				accountInfo = getUserDataFromColumnValue($(this).attr("ows_Business_Lead")); 
	
				$("#AccountInfo").html("").append("Login = " + accountInfo.login + "
"); $("#AccountInfo").append("Name = " + accountInfo.full_name + "
"); $("#AccountInfo").append("Email = " + accountInfo.email + "
"); $("#AccountInfo").append("Phone = " + accountInfo.WorkPhone + "
"); $("#AccountInfo").append("Title = " + accountInfo.Title+ "
"); $("#AccountInfo").append("Department = " + accountInfo.Department + "
"); }); } });

Apr 4, 2012 at 12:59 AM
Np. Glad to hear I was able to steer you to a solution. The only other suggestion to you, case performance becomes an issue, is cache the user information client side and use it before dipping back to the server next time around. Not sure if you are cycling through allot of records.

Would still like to hear from Marc on whether SPServices is building the XML request correctly, since I don't see the 'index' parameter being included.

_____
Paul

Sent from mobile device.

Coordinator
Apr 5, 2012 at 4:01 PM

Paul:

I just checked in one of my test environments with SPServices v0.7.1a and a call to GetUserProfileByIndex seems to work properly. It's a simple setup and I'm logged in as the Administrator with index=1.

M.

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserProfileByIndex xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">
<index>1</index>
</GetUserProfileByIndex>
</soap:Body>
</soap:Envelope>
<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">
<soap:Body>
<GetUserProfileByIndexResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">
<GetUserProfileByIndexResult>
<NextValue>2</NextValue>
<UserProfile>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>UserProfile_GUID</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:guid">e60b57df-d5bd-4f71-951e-ba0f5ff27921</Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>AccountName</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string">EUROPA\dharmesht</Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>FirstName</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>LastName</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>PreferredName</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string">EUROPA\dharmesht</Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>WorkPhone</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Office</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Department</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Title</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Manager</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>AboutMe</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>PersonalSpace</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string">/personal/dharmesht/</Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>PictureURL</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>UserName</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string">dharmesht</Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>QuickLinks</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>WebSite</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>PublicSiteRedirect</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Dotted-line</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Peers</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Responsibility</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Skills</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-PastProjects</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Interests</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-School</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-SipAddress</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-Birthday</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-MySiteUpgrade</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-DontSuggestList</Name>
<Privacy>Private</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-ProxyAddresses</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-HireDate</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-LastColleagueAdded</Name>
<Privacy>Private</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-OWAUrl</Name>
<Privacy>Private</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-ResourceAccountName</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>SPS-MasterAccountName</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Assistant</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>WorkEmail</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>CellPhone</Name>
<Privacy>Contacts</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Fax</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>HomePhone</Name>
<Privacy>Contacts</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>OfficeCode</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>OfficeName</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Project1Code</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Project1Name</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Project2Code</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Project2Name</Name>
<Privacy>Public</Privacy>
<Values></Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>Color</Name>
<Privacy>Private</Privacy>
<Values></Values>
</PropertyData>
</UserProfile>
<Colleagues></Colleagues>
<QuickLinks></QuickLinks>
<PinnedLinks></PinnedLinks>
<Memberships></Memberships>
</GetUserProfileByIndexResult>
</GetUserProfileByIndexResponse>
</soap:Body>
</soap:Envelope>
Apr 5, 2012 at 9:55 PM

Marc --

Thanks for the response.  The comment about "I'm logged in as the Administrator" looks like was the key element here.  As you had alluded to in your blog post I linked above, the "index" is still a pretty vauge value that does not appear to correlate to anything that I have access to.  It is definitely not the User_ID value that is tied to a People or Groups field based on the short testing that I did.  

So, back to my original question / issues -- I guess am just going to move forward with using the "ID;#DisplayName" value to lookup with SearchPrincipals to get the AD AccountName.  If additional profile data is needed, I will query GetUserProfileByName for that additional data.  As noted by Paul, I will try and cache as much as I can, but since this is only a single record display it should be pretty good. 

If you ever do find a way to get GetListItems to return the AccountName (DOMAIN\USER) instead of DisplayName let me know!

Thanks!

 

Coordinator
Apr 5, 2012 at 10:34 PM

GetListItems returns what it returns. I have no control over that, unfortunately.

M.

Apr 5, 2012 at 10:58 PM

Understandable.  Just love how SharePoint has a differnet way to do certain functions (Web Services vs Object Model).  

For what its worth .. I took a look a little deeper into the Index value.  From what I can tell, it is correlated to the User Profile store, but is not a direct ID in the normal context.  When a query is made to GetUserProfileByIndex, it actually brings back the 'next value' in the list rather than the record directly tied to it.  Likewise when you query for a record that is not available, the error message is the same as if you did not have Administrator permissions to run the Query (which leads to additional confusion).  As a result, in the below table the following actions would occur:

GetUserProfileByIndex(125) -> returns data for Rachel Smith

GetUserProfileByIndex(126) -> returns data for Tom Beard

GetUserProfileByIndex(127) -> returns error stating that you need Administrator permissions to perform action

RecordID	DocID	UserID	NTName	PreferredName	Email
125	236435	FC1E6E86-220E-41F5-8C52-02D6658833CC	DOMAIN\jdoe	John Doe	jdoe@email.com
126	236437	8B03B5BE-49AF-427B-A82F-55BE497CCD54	DOMAIN\rsmith	Rachel Smith	rsmith@email.com
130	274018	ED5937E5-D72A-49B1-ADA5-C50D63BE6070	DOMAIN\tbeard	Tom Beard	tbeard@email.com

These record numbers have no correlation (that I can find) to the specific user accounts on a site collection.  So, the ID that comes back from a People or Groups field has no correlation to that service.  End of story, the web service GetUserProfileByIndex really appears to be a total loss even if you had access directly to the UserProfile tables (SSP Database -> dbo.[UserProfile_Full])

Thanks!

Bryce

Coordinator
Apr 6, 2012 at 1:18 PM

I agree that it's an odd one. Why it passes data back for the next available index rather than the one you pass is beyond me. It would be useful if you wanted to list everyone, but otherwise, I don't understand why it works this way.

M.

Apr 6, 2012 at 1:53 PM

Marc: Thanks for your earlier response... I was using a old version of SPServices and not the most current... I'll stay away from this operation based on your blog post and the good information on this thread.

Paul.

Apr 12, 2012 at 5:17 PM

Hi,

I think this is the same problem I asked for here http://spservices.codeplex.com/discussions/262196 and after very long search I found this. Just add below to the CAMLQueryOptions and you get the info you want

 

CAMLQueryOptions: "<QueryOptions><ExpandUserField>True</ExpandUserField></QueryOptions>",

/Fredrik

 

Apr 12, 2012 at 5:17 PM

To the GetListItems that is.....

Apr 12, 2012 at 5:58 PM

Fredrik,

This is in deed very useful... I just checked the DOC's and Marc seems to have included your finding on the SPServices page for GetListItems... I also check the MS documentation for GetListItems (here) and it does not list this one... It does say "contains separate nodes for the various properties of the SPQuery object,"... In looking at SPQuery members, there are quite a few items that could be used (although I did not try).

Thanks.

Paul.

Apr 12, 2012 at 7:13 PM
fereko wrote:

Hi,

I think this is the same problem I asked for here http://spservices.codeplex.com/discussions/262196 and after very long search I found this. Just add below to the CAMLQueryOptions and you get the info you want

 

CAMLQueryOptions: "<QueryOptions><ExpandUserField>True</ExpandUserField></QueryOptions>",

/Fredrik

 

Fredrik -

Perfect! Thank you for pointing this out!  This is exactly what I was looking for and will allow me to perform the operations as expected.  Will definitely keep this query in mind with projects moving forward.

Bryce