我使用SPWeb.GetSiteData(SPQuery)对整个网站集中的表单库进行caml查询。对于字段“ServerUrl”,它只返回“/”而不是“/ site name / library name / formName.xml”。使用item [“ServerUrl”]返回正确的值,但我需要使用GetSiteData方法。
这是我的代码:
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);
答案 0 :(得分:1)
看似破旧的ServerURL似乎只是另一个有趣的SharePoint Web服务。如果您尝试获取该文件的完整URL,则可以从EncodedAbsUrl和FileRef字段构建它。
http://splucy.wordpress.com/2009/06/02/retrieve-pageurl-in-spsitedataquery/