开发者

Sharepoint SPQuery problem

开发者 https://www.devze.com 2023-03-25 02:56 出处:网络
I\'m trying to use GetItems() method on a SPList and I pass SPQuery to it. The problem is, it return all the items from my SPList instead of just the filtered ones. My query looks like this:

I'm trying to use GetItems() method on a SPList and I pass SPQuery to it. The problem is, it return all the items from my SPList instead of just the filtered ones. My query looks like this:

 <WHERE><Eq><FieldRef Name='Type' /><Value Type='Text'>Analysis</Value></Eq></WHERE>

Thye typye of the'Type' column is Single line of text, which i believe translates to Text in CAML. Then I just do the standard stuff:

SPQuery q = new SPQuery();
q.Query = CAMLQuery.ToString();
var filtered = _NoticeList.GetItems(q);

filtered.Count is 4 inste开发者_如何学编程ad of 2... perhaps someone cann se whats wrong with this code


I think CAML is Case sensitive so it'd have to be:

<Where><Eq><FieldRef Name='Type' /><Value Type='Text'>Analysis</Value></Eq></Where>

Otherwise you could try renaming the 'Type' field, because it might be interpreted as an internal field.

0

精彩评论

暂无评论...
验证码 换一张
取 消