0

我正在尝试过滤由以下 Web 服务调用返回的结果列表到 SharePoint 列表。当我有

query.InnerText = "";

结果包括 SharePoint 列表中的每一行 - 包括 IN SERVICE DATE 小于今天、大于今天或根本没有值的行。我需要 CAML 查询来过滤,但添加 Where 语句不起作用。

service.Url = url;
String pipeProjectSummaryListGuid = "{2D193799-F1FB-46B1-A313-56B8B12E1111}";

XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlElement query = xmlDoc.CreateElement("Query");
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
String rowLimit = "9000";

query.InnerText = "<Where><Gt><FieldRef Name=\"In_x0020_Service_x0020_Date\" /><Value Type=\"DateTime\"><Today /></Value></Gt></Where>";
viewFields.InnerXml = "<FieldRef Name=\"NEW_ID\" /><FieldRef Name=\"In_x0020_Service_x0020_Date\" /><FieldRef Name=\"ProjectPriority\" />";
queryOptions.InnerXml = "<ViewAttributes Scope=\"Recursive\" /><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>";

try
{
    results = service.GetListItems(pipeProjectSummaryListGuid, null, query, viewFields, rowLimit, queryOptions, null);
}
4

1 回答 1

0

尝试使用query.InnerXml而不是query.InnerText.

于 2012-04-13T12:43:14.907 回答