我有这个CAML查询
var query = new SPQuery
{
Query = string.Format(@"<Where>
<Or>
<Or>
<Or>
<Or>
<Contains>
<FieldRef Name='{7}' />
<Value Type='Text'>{3}</Value>
</Contains>
</Or>
<Contains>
<FieldRef Name='{6}' />
<Value Type='Text'>{2}</Value>
</Contains>
</Or
<Contains>
<FieldRef Name='{5}' />
<Value Type='Text'>{1}</Value>
</Contains>
</Or>
<Contains>
<FieldRef Name='{4}' />
<Value Type='Text'>{0}</Value>
</Contains>
</Or>
</Where>", "title", "adress", "zipcode", "city", "searchTitle", "searchAdress", "searchZipcode", "searchCity")
};每次运行它,我尝试使用List.GetItems(query);时,它都会抛出这个错误:
One or more field types are not installed properly. Go to the list settings page to delete these fields.但!如果我删除了所有的<Or>标签,它就能正常工作并且不会抛出这个错误,但我需要<Or>标签来确保它获得所有的命中。
我已经确保所有的fieldref都与列的内部名称100%匹配。
发布于 2011-08-15 21:54:03
你有没有试过在没有包含7/3元素的情况下进行查询?这是我不需要的。
此外,您/或的中有一个没有右括号<Value Type='Text'>{2}</Value></Contains></Or<Contains>,这可能是导致错误的原因。
发布于 2011-08-16 21:01:30
更正您的CAML
var query = new SPQuery
{
Query = string.Format(@"<Where>
<Or>
<Or>
<Or>
<Contains>
<FieldRef Name='{7}' />
<Value Type='Text'>{3}</Value>
</Contains>
<Contains>
<FieldRef Name='{6}' />
<Value Type='Text'>{2}</Value>
</Contains>
</Or>
<Contains>
<FieldRef Name='{5}' />
<Value Type='Text'>{1}</Value>
</Contains>
</Or>
<Contains>
<FieldRef Name='{4}' />
<Value Type='Text'>{0}</Value>
</Contains>
</Or>
</Where>", "title", "adress", "zipcode", "city", "searchTitle", "searchAdress", "searchZipcode", "searchCity")
};https://stackoverflow.com/questions/7065556
复制相似问题