I am trying to send meeting invitation by Appointment class of EWS. I have a requirement to send different attachment to different recipients. I am referencing the following links:
This link is just for one or more than one attachment might to be sent but I need each recipients should have different-2 attachments.
I am trying to following in my code that might be helpful to better understand the challenge:
Appointment appointment = new Appointment(service) {
Start = DateTime.Now,
End = DateTime.Now.AddHours(2),
Subject = "XYZ Invitation",
Location = "XYZ Tower, Room No. 3",
IsAllDayEvent = false,
AllowNewTimeProposal = false,
IsResponseRequested = false,
Body = new MessageBody(BodyType.HTML, html),
ReminderMinutesBeforeStart = 60
};
int i = 0;
foreach(var attendee in attendies) { // List<string>
appointment.Attachments.AddFileAttachment(Image[i], file);
appointment.Attachments[0].IsInline = true;
appointment.Attachments[0].ContentId = Image[i];
FolderId folderCalendar = new FolderId(WellKnownFolderName.Calendar, attendee);
appointment.Save(folderCalendar, SendInvitationsMode.SendToNone);
appointment.RequiredAttendees.Add(attendee);
i++;
appointment.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendOnlyToAll);
}
You must use Bind method of Appointment class in order to send different attachment second time to add receipt.
appointment.Bind(ExchangeService, ItemId, PropertySet);
Binds to an existing appointment and loads the specified set of properties. Calling this method results in a call to Exchange Web Services (EWS).
I hope it helps you.