0

I have a view on my custom list that filters items created by me.I deleted this filter.Even though in my server object model I am getting item collection created by [me] through spquery. I checked my caml query in u2u caml builder.It returns items Perfectly.Only Problem with spquery.Any ideas.This Problem is not with query .It deals with filtered items.I am unable to see items created by others.Even though i removed filtering in view .It is filtering items on User view.Please help me

  • Post the SPQuery you are trying with? – Amal Hashim Nov 13 '14 at 12:42
  • <OrderBy><FieldRef Name='FWorkDate' Ascending='TRUE'/></OrderBy><Where><And><Eq><FieldRef Name='User'/><Value Type='User'>john</Value></Eq><And><Geq><FieldRef Name='WorkDate' /><Value Type='DateTime'>2014-11-13T16:57:01Z</Value></Geq><Leq><FieldRef Name='WorkDate' /><Value Type='DateTime'>2014-11-13T16:57:01Z</Value></Leq></And></And></Where> – user3492718 Nov 13 '14 at 13:21
  • 1
    @user3492718 Are you sure field name is correct.. Since in OrderBy you are giving FWorkDate, while in Where clause you are giving WorkDate.. Also Geq and Leq values are same, it's like get me values between 5 and 5, of couse there are no values in between.. Did you try changing the date ranges? – Arsalan Adam Khatri Nov 13 '14 at 13:48
  • yes fields names are correct.I tested with different data ranges but no use.I am getting data on u2u caml builder.Only front end i am not getting data by server object model – user3492718 Nov 13 '14 at 13:57
  • I resolved my Problem by giving draft items visibility to all and removed all filters in list view.Thanks for responses – user3492718 Nov 14 '14 at 10:08
0

Try this

<Where>
    <And>
        <And>
            <Eq>
                <FieldRef Name='User'/>
                <Value Type='User'>john</Value>
            </Eq><And>
            <Geq>
                <FieldRef Name='WorkDate' />
                <Value Type='DateTime'>2014-11-13T16:57:01Z</Value>
            </Geq>
        </And>      
        <Leq>
            <FieldRef Name='WorkDate' />
            <Value Type='DateTime'>2014-11-13T16:57:01Z</Value>
        </Leq>
    </And>
</Where>
<OrderBy>
    <FieldRef Name='FWorkDate' Ascending='TRUE'/>
</OrderBy>

Also you should make sure the display name is john

  • No It didn't resolved my problem . – user3492718 Nov 14 '14 at 6:29
  • I resolved my Problem by giving draft items visibility to all and removed all filters in list view.Thanks for response – user3492718 Nov 14 '14 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.