-1

Using CAML query, I have this requirement to retrieve items from calendar list where date is neither an Event Date nor an End Date but exists in a span of {Event & End} time like so:

Calendar View

I have tried creating a CAML query but unable to get a handle on retrieving the selected item in the above image where date i am querying is 2/18/2015.

Can some one point me in the right direction in writing a CAML query which help me retrieve the selected item by passing 2/18/2015 date as query value for Start/End time fields?

  • I'd recomment grabbing the BIWUG CAML Designer from here, biwug.be/resources. – Eric Alexander Jan 8 '15 at 18:15
  • So you want to input a date (say 2/18/2015) and you want to retrieve all the items that the input date falls between items' "START TIME" and "END TIME" column values. Is that what you mean? – Paiman Samadian Jan 8 '15 at 23:18
  • Yes @PaimanSamadian – Muhammad Usman Jan 9 '15 at 17:16
0

You need to know the internal names of the columns "Start Time" and "End Time". I will assume they are "StartTime" and "EndTime" respectively. Hence:

   <Where>
      <And>
         <Lt>
            <FieldRef Name='StartTime' />
            <Value IncludeTimeValue='TRUE' Type='DateTime'>2015-02-18</Value>
         </Lt>
         <Gt>
            <FieldRef Name='EndTime' />
            <Value IncludeTimeValue='TRUE' Type='DateTime'>2015-02-18</Value>
         </Gt>
      </And>
   </Where>

To find a field's internal name: How to get Internal names of columns in sharepoint lists

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.