CAML Query for calender list


To get all events in current month:

        <FieldRef Name="EventDate" />
        <FieldRef Name="EndDate" />
        <FieldRef Name="RecurrenceID" />
        <Value Type="DateTime"><Month /></Value>

To get all todays events:

string PreviousDay = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") ;
string NextDay = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd");
string query =
        <FieldRef Name='EventDate' />
        <Value IncludeTimeValue='FALSE' Type='DateTime'>" + PreviousDay  + "</Value>
         <FieldRef Name='EventDate' />
         <Value IncludeTimeValue='FALSE' Type='DateTime'>" + NextDay  + "</Value>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s