Forum Discussion

badar_000's avatar
badar_000
Copper Contributor
Aug 07, 2022
Solved

CAML Query to filter library not working as expected

below the is the CAML query i am using in my code for fetching data and binding to DATALIST control...    _query.Query = "<View><Query><Where><And><Eq><FieldRef Name='Description0' /><Value Type='T...
  • badar_000's avatar
    badar_000
    Aug 11, 2022

    kalpeshvaghela ganeshsanap 

     

    Dear All, I used below format and it worked, thanks for your support... I am sharing below CAML code...

    string Iso8601Today = XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Local);

     

    _query.ViewXml = "<View><Query>" +
    "<Where>" +

    "<Leq>" +
    "<FieldRef Name='testDate'/>" +
    "<Value IncludeTimeValue='FALSE' Type='DateTime'>"+Iso8601Today+"</Value>" +
    "</Leq>" +
    "</Where>" +
    "<OrderBy><FieldRef Name ='Created' Ascending = 'True' /></OrderBy></Query></View>";

     

    I got the required result, please add your comment for more optimization ...

     

    regards

    Badar

Resources