Creating a recurring calendar event with php-ews

767 Views Asked by At

I am trying to create a recurring calendar event with php-ews and the documentation is very limited in this aspect. I have got what is below so far I just can not find out how to have it repeat say every Monday and Wednesday. Can anyone who has done this before or knows how help me out?

$request->Items->CalendarItem->Recurrence = new Type\RecurrenceType();
$request->Items->CalendarItem->Recurrence->WeeklyRecurrence = new Type\IntervalRecurrencePatternBaseType();
$request->Items->CalendarItem->Recurrence->NumberedRecurrence = new Type\NumberedRecurrenceRangeType();
$request->Items->CalendarItem->Recurrence->NumberedRecurrence->NumberOfOccurrences = 2;
$request->Items->CalendarItem->Recurrence->NumberedRecurrence->StartDate = //start date here;
1

There are 1 best solutions below

0
On BEST ANSWER

I've successfully used this...

// Set up recurrence days
        $request->Items->CalendarItem->Recurrence = new EWSType_RecurrenceType();
        $request->Items->CalendarItem->Recurrence->WeeklyRecurrence = new EWSType_IntervalRecurrencePatternBaseType(); 
        $request->Items->CalendarItem->Recurrence->WeeklyRecurrence->Interval = 1;
        $request->Items->CalendarItem->Recurrence->WeeklyRecurrence->DaysOfWeek = new EWSType_ArrayOfStringsType();
        $request->Items->CalendarItem->Recurrence->WeeklyRecurrence->DaysOfWeek = array(EWSType_DayOfWeekType::MONDAY, EWSType_DayOfWeekType::WEDNESDAY, EWSType_DayOfWeekType::FRIDAY);                
        // Specify recurrence start and end
        $request->Items->CalendarItem->Recurrence->EndDateRecurrence = new EWSType_EndDateRecurrenceRangeType(); 
        $request->Items->CalendarItem->Recurrence->EndDateRecurrence->EndDate = '2014-05-30'; 
        $request->Items->CalendarItem->Recurrence->EndDateRecurrence->StartDate = '2014-05-14'; 

Looks like you're just missing the DaysOfWeek array item. Adjust your array as needed based on the days you'd like the meeting to occur, and of course set your own start and end dates as well. I believe the Interval item would be equivalent to 1=every week, 2=every other week, etc. but i have not tested that.