CAML to Query for Recurring Events

Caml query

SharePoint 101

When you query a SharePoint calendar your results will contain:

  • All non-recurring events
  • The first event of a recurring event series

And won’t contain:

  • All remaining events in recurring event series’

Here is the CAML you need to execute to retrieve all events, including all events in recurring event series:

<listname>My Calendar</listname>

<query>

    <Query>

        <Where>

            <DateRangesOverlap>

                <FieldRef Name=”EventDate”></FieldRef>

                <FieldRef Name=”EndDate”></FieldRef>

                <FieldRef Name=”EventDate”></FieldRef>

                <Value Type=”DateTime”>

                    <Year />

                </ValueType>

            </DateRangesOverlap>

        </Where>

    </Query>

</query>

<queryOptions>

    <QueryOptions>

        <RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>

        <ExpandRecurrence>

    </QueryOptions>

</queryOptions>

<viewFields>

    <FieldRef Name=”EventDate” />

    <FieldRef Name=”EndDate” />

    <FieldRef Name=”fRecurrence” />

    <FieldRef Name=”RecurrenceData” />

</viewFields>

View original post

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s