This project has moved and is read-only. For the latest updates, please go here.

Query and webURL

Jul 10, 2012 at 2:08 PM
Edited Jul 10, 2012 at 5:28 PM

Any reason this shouldn't work?  I'm positive cross-domain works as other SPServices queries are working fine.... in fact, GetUserProfileByName works great cross-domain for me.  Note, if I take out the webURL and make lastName valid in the current domain, it works fine as well.

Here b me code --

            operation: "Query",
           webURL: "",
            async: false,
            queryXml: queryText,
            completefunc: function (xData, Status) {
                $(xData.responseXML).find("QueryResult").each(function () {


      var lastName = 'Anderson';
      var queryText = '<?xml version=\"1.0\" encoding=\"utf-8\" ?>'
         + '<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">'
         + '<Query domain=\"INT\">'
         + '<SupportedFormats>'
         + '<Format>urn:Microsoft.Search.Response.Document.Document</Format>'
         + '</SupportedFormats>'
         + '<Context>'
         + '<QueryText language=\"en-US\" type=\"MSSQLFT\">'
         + 'SELECT AccountName, Department, WorkId, Description, PreferredName, LastName, Title, Path, MobilePhone FROM SCOPE() WHERE '
         + "(\"DAV:contentclass\" = 'urn:content-class:SPSPeople') "
                    + " AND (\"LASTNAME\" LIKE '%" + lastName + "%')"
         + '</QueryText>'
         + '</Context>'
         + '</Query>'
         + '</QueryPacket>';

Alternatively, I could use the GetUserProfileByName, but I would first need to figure out how to bring back usernames with a wildcard search. If I could do that, then I could have users pick a particular name.
Jul 11, 2012 at 3:33 AM

Got this to work.  Was actually an issue on my people search on the other site.  Never would have known that either.......

Jul 12, 2012 at 2:28 AM


Sometimes - but very often not - the returned XML will give you a clue where the issue is. The other thing you can do it look at the Net traffic with Firebug or Fiddler. There are so many just, plain odd network topologies out there that it's usually hard for me to make suggestions.


Dec 12, 2013 at 7:59 PM
If I may ask, what was the issue on the site? I was trying to re-purpose your example, but when I look at what is being returned it's just an error:
<?xml version="1.0" encoding="utf-8"?><ResponsePacket xmlns="urn:Microsoft.Search.Response"><Response domain=""><Status>ERROR_SERVER</Status><DebugErrorMessage>System.NotSupportedException</DebugErrorMessage></Response></ResponsePacket>
Dec 13, 2013 at 2:30 AM
Ah, I may have answered my own question...although I'm too inexperienced to fully understand why yet. I changed my querystring from the above example to this simpler format. (Only showing car* names in this case.)
var queryText = '<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">'
+ '<Query domain="QDomain">'
+ '<SupportedFormats>'
+ '<Format>urn:Microsoft.Search.Response.Document.Document</Format>'
+ '</SupportedFormats>'
+ '<Context>'
+ '<QueryText language="en-US" type="STRING">Carl* Scope:"People"</QueryText>'
+ '</Context>'
+ '</Query>'
+ '</QueryPacket>'