views:

197

answers:

1

Hi. I do a caml query on the forms libraries in entire site collection with SPWeb.GetSiteData(SPQuery). For the field "ServerUrl" it returns just "/" instead of "/site name/library name/formName.xml". With item["ServerUrl"] is returns the right value, but i need to use the GetSiteData method.

Here is my code:

SPSiteDataQuery q = new SPSiteDataQuery();
q.Lists = "<Lists ServerTemplate='115' />";
q.Query = "<Where><And><And>"
      + "<Eq><FieldRef Name='" + UserId + "' /><Value Type='Text'>" + User + "</Value></Eq>"
      + "<Geq><FieldRef Name='Created' /><Value Type='DateTime'>" + dateFrom + "</Value></Geq></And>"
      + "<Leq><FieldRef Name='Created' /><Value Type='DateTime'>" + dateTo + "</Value></Leq></And></Where>";
q.Webs = "<Webs Scope='SiteCollection' />";
q.ViewFields =
    "<FieldRef Name='Title' />" +
    "<FieldRef Name='ID' />" +
    "<FieldRef Name='Created' />" +
    "<FieldRef ID='" + officeId + "' />" +
    "<FieldRef ID='" + formStatusId + "' />" +
    "<FieldRef ID='" + accessTypeId + "' />" +
    "<FieldRef Name='ServerUrl' />" +
    "<FieldRef Name='FileRef' />";
ret = web.GetSiteData(q);
A: 

The seemingly broken ServerURL appears to be just another SharePoint web service funny. If your trying to get the full url for the file then you can build it up from the EncodedAbsUrl and FileRef fields.

http://blogs.tamtam.nl/lucy/2009/06/02/RetrievePageurlInSPSiteDataQuery.aspx

Dan Revell
I've already tried that. FileRef gives me the same as ServerUrl, but EncodedAbsUrl gives just the domain name. :(
Alexandr