我正在尝试使用此查询从列表中检索项目:
query.Query =
@"<Where>
<And>
<And>
<Geq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateFrom) + @"</Value>
</Geq>
<Leq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateTo) + @"</Value>
</Leq>
</And>
<In>
<FieldRef Name='Employee' LookupId='TRUE' />
<Values>
<Value Type='int'>1</Value>
<Value Type='int'>3</Value>
</Values>
</In>
</And>
</Where>";
在运行时我得到以下异常:
SPException:一个或多个字段类型未正确安装。进入列表设置页面,
在线删除这些字段List.GetItems(query)
。
如果我像这样修改 SPQuery:
query.Query =
@"<Where>
<And>
<Geq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateFrom) + @"</Value>
</Geq>
<Leq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateTo) + @"</Value>
</Leq>
</And>
</Where>";
或这个:
query.Query =
@"<Where>
<In>
<FieldRef Name='Employee' LookupId='TRUE' />
<Values>
<Value Type='int'>1</Value>
<Value Type='int'>3</Value>
</Values>
</In>
</Where>";
一切正常。