Parsing user profile search response

Oct 18, 2010 at 9:47 PM

I am using the query service to get some profile information. The response that I am getting looks like this

 <ResponsePacket xmlns="urn:Microsoft.Search.Response">
- <Response>
- <Range>
  <StartAt>1</StartAt>
  <Count>2</Count>
  <TotalAvailable>53</TotalAvailable>
- <Results>
- <Document xmlns="urn:Microsoft.Search.Response.Document">
- <Action>
  <LinkUrl fileExt="aspx">http://luisdev:4000/Person.aspx?guid=3EFCBFD1-51E8-4B1A-A341-AE71C94C703F</LinkUrl>
  </Action>
- <Properties xmlns="urn:Microsoft.Search.Response.Document.Document">
- <Property>
  <Name>LASTNAME</Name>
  <Type>String</Type>
  <Value>ADCrawler</Value>
  </Property>
- <Property>
  <Name>FIRSTNAME</Name>
  <Type>String</Type>
  <Value>Portal</Value>
  </Property>
- <Property>
  <Name>OBJECTID</Name>
  <Type>String</Type>
  <Value>3EFCBFD1-51E8-4B1A-A341-AE71C94C703F</Value>
  </Property>
- <Property>
  <Name>TITLE</Name>
  <Type>String</Type>
  <Value>Portal ADCrawler</Value>
  </Property>
- <Property>
  <Name>RANK</Name>
  <Type>Int64</Type>
  <Value>1000</Value>
  </Property>
- <Property>
  <Name>SIZE</Name>
  <Type>Int64</Type>
  <Value>0</Value>
  </Property>
- <Property>
  <Name>PATH</Name>
  <Type>String</Type>
  <Value>http://luisdev:4000/Person.aspx?guid=3EFCBFD1-51E8-4B1A-A341-AE71C94C703F</Value>
  </Property>
- <Property>
  <Name>WRITE</Name>
  <Type>DateTime</Type>
  <Value>2010-10-14T14:17:55-05:00</Value>
  </Property>
  </Properties>
  </Document>
- <Document xmlns="urn:Microsoft.Search.Response.Document">
- <Action>
  <LinkUrl fileExt="aspx">http://luisdev:4000/Person.aspx?guid=7C138728-12BC-4CB6-98B0-063BE3EB3CDB</LinkUrl>
  </Action>
- <Properties xmlns="urn:Microsoft.Search.Response.Document.Document">
- <Property>
  <Name>LASTNAME</Name>
  <Type>String</Type>
  <Value>Admin</Value>
  </Property>
- <Property>
  <Name>FIRSTNAME</Name>
  <Type>String</Type>
  <Value>DevSP</Value>
  </Property>
- <Property>
  <Name>OBJECTID</Name>
  <Type>String</Type>
  <Value>7C138728-12BC-4CB6-98B0-063BE3EB3CDB</Value>
  </Property>
- <Property>
  <Name>TITLE</Name>
  <Type>String</Type>
  <Value>DevSP Admin</Value>
  </Property>
- <Property>
  <Name>RANK</Name>
  <Type>Int64</Type>
  <Value>1000</Value>
  </Property>
- <Property>
  <Name>SIZE</Name>
  <Type>Int64</Type>
  <Value>0</Value>
  </Property>
- <Property>
  <Name>PATH</Name>
  <Type>String</Type>
  <Value>http://luisdev:4000/Person.aspx?guid=7C138728-12BC-4CB6-98B0-063BE3EB3CDB</Value>
  </Property>
- <Property>
  <Name>WRITE</Name>
  <Type>DateTime</Type>
  <Value>2010-10-14T14:17:55-05:00</Value>
  </Property>
  </Properties>
  </Document>
  </Results>
  </Range>
  <Status>SUCCESS</Status>
  </Response>
  </ResponsePacket>

I need to get the LASTNAME and FIRSTNAME values but I'm having some trouble.

thanks,

Luis

Coordinator
Oct 18, 2010 at 9:49 PM

Can you post the jQuery you're using so that I can try to duplicate this?

M.

Oct 19, 2010 at 1:11 PM
This is the code I'm using.
 
var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query'><Query><SupportedFormats><Format>urn:Microsoft.Search.Response.Document:Document</Format></SupportedFormats><Context><QueryText type=\"MSSQLFT\" language=\"en-us\">select lastname, firstname, workemail, workphone, objectid, Title, Rank, Size, Path, Description, Write from scope() where \"scope\" = 'People' order by LastName</QueryText></Context><Range><StartAt>1</StartAt><Count>2</Count></Range><EnableStemming>true</EnableStemming><TrimDuplicates>true</TrimDuplicates><IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery><ImplicitAndBehavior>true</ImplicitAndBehavior><IncludeRelevanceResults>true</IncludeRelevanceResults><IncludeSpecialTermResults>true</IncludeSpecialTermResults><IncludeHighConfidenceResults>true</IncludeHighConfidenceResults></Query></QueryPacket>";



    $().SPServices({  

            operation: "Query",  

            queryXml: queryText,  

            completefunc: function(xData, Status) {  

                $(xData.responseXML).find("QueryResult").each(function() {  
                  alert(xData.responseXML.xml);

                   

                    });
                    

                });  

            }  

        }); 

Oct 19, 2010 at 7:36 PM

I found the answer to my question here: 

http://www.itidea.nl/index.php/example-of-using-the-spservices-search-web-service/

However, I will still like to know how to get the status text

thanks,

Luis

 

 

Coordinator
Oct 20, 2010 at 2:12 PM

Luis:

Do you mean the status text coming back from the AJAX call? That's in the Status parameter in your completefunc. I'm guessing you mean something else, though.

M.