Dmitry Melnikov
Dmitry Melnikov

Reputation: 86

How can a delegate get a recurring master from the mailbox owner's Calendar folder with EWS Managed API?

There is a planner app that reads appointments from the Exchange calendar located at [email protected] account and does some business logic based on the appointment content. Users of the same Exchange server create their appointments and add [email protected] as a Required Attendee. [email protected] account has delegate rights to read from and write to user accounts' calendar events.

There is one case I am struggling with.
A user created a recurring daily event in its calendar from Feb 25 to Feb 28 (4 instances) but did not include [email protected] calendar as a Required Attendee for the whole event, rather only for the single Feb 26 instance.

In the [email protected] calendar such instance will be retrieved as an Appointment with IsRecurring set to true but AppointmentType set to AppointmentType.Single. For business logic I need to get a Recurring Master of a recurring event.

How can I get a Recurring Master of the Feb 26's instance?

Usual way to get a recurring master is explained in MSDN

recurrMaster = Appointment.BindToRecurringMaster(service, itemId, props);

Problem is that for a AppointmentType.Single event such method throws an exception with error code ErrorCalendarCannotUseIdForOccurrenceId

I have Feb 26 appointment's ItemId and organizer email address but I don't have organizer password therefore I cannot create another ExchangeServer instance to access the organizer calendar directly.

There is the ExchangeService.FindItems method with many overloads, particularly:

FindItems(FolderId, String, ViewBase)

Returns items from a target folder according to the associated search query with the specified preview page view.

FindItems(FolderId, SearchFilter, ViewBase)

But I could find any explanation neither on how to write a search query nor how to specify a search filter to get a Recurring Master event.

Could you please help me with this issue?

Upvotes: 0

Views: 71

Answers (1)

Dmitry Melnikov
Dmitry Melnikov

Reputation: 86

Since I am quite new to EWS I could not formulate the question properly. Here is actually the same question, but formulated much clearer, and the answer EWS - Given an Appointment, get the owner's copy of the Appointment. It worked for me.

Upvotes: 0

Related Questions