0

I'm trying to get all the occurence generated by a recurrent event with CSOM and CAML query

So for example if the event "Test" happens every year from today I would like to get the following dates occurences:

1/6/2017 1/6/2018 1/6/2019 ....

My caml query is:

<Query>
<Where>
<And>
<Contains>
<FieldRef Name="Title" />
<Value Type='Text'>Test event</Value>
</Contains>
   <DateRangesOverlap>
    <FieldRef Name="EventDate" />
    <FieldRef Name="EndDate" />
    <FieldRef Name="RecurrenceID" />
    <Value Type='DateTime'><Year/></Value>
   </DateRangesOverlap>
</And>

  </Where>
<QueryOptions>
        <IncludeMandatoryColumns>false</IncludeMandatoryColumns>
        <ViewAttributes Scope="Recursive"/>
        <RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>
        <ExpandRecurrence>true</ExpandRecurrence>
        <RecurrenceOrderBy>true</RecurrenceOrderBy>
        <ViewAttributes Scope="RecursiveAll"/>
        <CalendarDate>
        <Today/>
        </CalendarDate>
    </QueryOptions>
</Query>

I see I can get the RecurrenceData xml. Maybe I could infer the events from the xml retrieved but it is not easy to interpret. Maybe there is a better way to gete the dates of each occurrence?

1 Answer 1

0

You cannot retrieve it from SharePoint directly using CSOM. Instead you can use SOAP request.

To retrieve the same using CSOM, you can use the SPCalendarRecurrenceExpander package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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