views:

1929

answers:

2

I am trying to build a CAML query for SharePoint 2007 environment, to get items from a calendar list. Want to query items with a given 'From date' and 'To date', the calendar list contains 'EventDate' and 'EndDate' in Datetime format. I am only interested in the date part of the datetime field.

How can I trim the "EventDate" DateTime field of Calendar list to just Date and compare?

Is there any other way to get this done apart from CAML.

+2  A: 

Unfortunately you have to use CAML.

You should be able to trim the time part...

<Where>
   <Gt>
       <FieldRef Name='EventDate' />
       <Value IncludeTimeValue='FALSE' Type='DateTime'>2008-12-03T12:00:00Z</Value>
   </Gt>
</Where>
A: 

Conversely, if you are working in with the object model in code, you can use LINQ to SharePoint (http://www.codeplex.com/LINQtoSharePoint).

In the background, the project is just creating a CAML Query for you but you won't have to use CAML directly.

Rick Kierner