在预约EWS (Exchange Web Service)中向不同的收件人发送不同的附件

本文关键字:收件人 EWS Exchange Service Web | 更新日期: 2023-09-27 18:09:30

我正在尝试通过EWS的Appointment类发送会议邀请。我有一个要求,发送不同的附件给不同的收件人。我引用了以下链接:

https://social.msdn.microsoft.com/forums/exchange/en us/cf4b9d9a - 7 bbb - 4 - caa 9 d55 - 300371 - fa84ac/ews -附件-不-发送邀请

这个链接只是一个或多个附件可以发送,但我需要每个收件人应该有不同的2个附件。

我试着在我的代码中,这可能有助于更好地理解挑战:

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);
}

在预约EWS (Exchange Web Service)中向不同的收件人发送不同的附件

必须使用Appointment类的Bind方法,以便第二次发送不同的附件来添加收据。

appointment.Bind(ExchangeService, ItemId, PropertySet);

绑定到现有的约会并加载指定的属性集。调用此方法将导致对Exchange Web Services (EWS)的调用。