I need to display every calendar item (both recurrence or not) that should show event with enddate "on" or "greater than" Today, and sorted by StartDate. I have created CAML query below. However, the results puzzled me. For example, I have recurring event that is set to every day from 1 Feb - 31 March 2011. If today is 02 March 2011, it will show recurring event start from 22 Feb 2011. I need to show calendar items that end date start from 02 March 2011. Any idea? Thanks.
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="RecurrenceID" />
<FieldRef Name='EndDate' />
<FieldRef Name="EventDate" Ascending="True" />
A recurring event is a single entry in the calendar's list of events. Therefore, you're query cannot retrieve only part of that entry. It retrieves all of the recurring events in a given entry or none of the recurring events in the entry. The recurring event entry's end date field should contain the end date for the last event that is part of the series of recurring events.
I had a similiar problem and was able to create a web part which added "recurring events" as series of individual events. However, the types of events on my calendar were very specialized, so this was possible; it may or may not work for you. I can't think of any other way around it.
Stephen P. Kappel Sharepoint Developer - PCdotCOM
Thank you Stephen,
The weird thing that I have now is that the recurring event start at 1 Feb, but the CAML call returns recurring event start from 22 Feb only (about a week earlier). If the validation is checked for the last recurring event, it should shows event start from 1 Feb. Any idea?
I am very puzzled.. Once I set the DateRangesOverlap set to "Year", it shows correctly..
I try to set to Month, and use paging to retrieve next page using ItemLimit and ListItemCollectionPosition, however, the ListItemCollectionPosition always return NULL. Any idea?
When you use the query above you posted to query recurring event, it means that you want to get events, the period between the event date and the end date of which overlaps with the time beginning from now to one month later in the future.
So even that the event started from 1 Feb, but if the end time of the event is greater than the current date, it would be returned.
And you said 'show calendar items that end date start from 02 March 2011'. I am confused that the end date can last for long time.
Or did you mean the end date was greater than 02 March 2011? If it was, the following code is not necessary.
<Geq> <FieldRef Name='EndDate' /> <Value Type='DateTime'> <Today /> </Value> </Geq>
Microsoft Online Community Support
Yes, I have the And Operator on my CAML above, and already include the CAML condition you have mentioned. But the query with Overlap on Month still returns recurring event from last week. I am also confused why Overlap set to Year returns expected result.