SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to fetch all the items on a particular day. Programmatically the entry is added as recurring event, Now i need to fetch all the instances of recurring event, on each day as per the date selected by the user.

E.g: I have made 3 recurring entries on 12thSept and which ends on 21stSept with all three having different TIME and a seperate ROOM NAME Calendar

I want to fetch all the items on 12th,13th,14th and so on till 21st as per the date selected.

The following is the code i am working with to fetch all the entries on a selected day, bt the issue i am having here is, The query returns items only if i select date as 12thSept and for all other dates i.e from 13th to 21st the query does not return any result.

    SPQuery oQueryBookings = new SPQuery();

                            string strQuery = "";
                            oQueryBookings.ExpandRecurrence = true;
                            //oQueryBookings.Query = strQuery;
                            oQueryBookings.CalendarDate = date.Date;
                            SPListItemCollection oCollBookings = null;
                            strQuery = "<Where><And><DateRangesOverlap><FieldRef Name='EventDate' />" +
                            "<FieldRef Name='EndDate' />" +
                                       "<FieldRef Name='RecurrenceID'/>" +
                                       "<Value Type='DateTime'>" +
                                       "<Today />" +
                                       "</Value>" +
                                      "</DateRangesOverlap>" +
                                      "<Eq><FieldRef Name='Room' /><Value Type='Lookup'>" + room + "</Value></Eq>" +

oQueryBookings.ViewFields = string.Concat("<FieldRef Name='Title' />" +
                    "<FieldRef Name='EventDate' />" +
                    "<FieldRef Name='EndDate' />" +
                    "<FieldRef Name='Location' />" +
                    "<FieldRef Name='Description' />" +
                    "<FieldRef Name='fRecurrence' />" +
                    "<FieldRef Name='RecurrenceData' />" +
                    "<FieldRef Name='fAllDayEvent' />" +
                    "<FieldRef Name='LinkTitle'/>" +
                    "<FieldRef Name='Room'/>");

                            oQueryBookings.Query = strQuery;
                            oCollBookings = list.GetItems(oQueryBookings);
                            if (oCollBookings.Count > 0)
                               //Code Here
share|improve this question
up vote 0 down vote accepted

The issue was with saving the EndDate once end date was saved the entries get fetched correctly with ExpandRecurrence and CalendarDate

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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