简体   繁体   中英

How does one send an exchange appointment invite to only one of the required attendees programmatically with C#?

I only want the room's email to receive an invitation, not the other requiredAttendees. However, the "Save()" method appears to only have a send to all or none type of setup. Does anyone have a solution?

appointment.Subject = myAppointmentInfo.ClassName;
appointment.Body = "";
appointment.Start = myAppointmentInfo.StartDateTime;
appointment.End = myAppointmentInfo.EndDateTime;
appointment.Location = myAppointmentInfo.Location;
appointment.ReminderMinutesBeforeStart = 5;

appointment.RequiredAttendees.Add(employeeEmail1);
appointment.RequiredAttendees.Add(employeeEmail2);
appointment.RequiredAttendees.Add(roomEmail);

appointment.Save(SendInvitationsMode.SendToNone);

I have a partial solution to this now. What I ended up doing was this:

var calendar = Folder.Bind(service, new FolderId(WellKnownFolderName.Calendar, roomEmail));
appointment.Save(calendar.Id, SendInvitationsMode.SendToNone);

It allowed me to send to only the roomEmail, but still have the other required attendees show up on the list of Required Attendees.

This solved my initial problem, but now I need to learn how to do something similar for my appointment updates and deletes (which is proving to be more difficult). If you know how to do these things please let me know! Thanks

UPDATE: I found my issue with this problem as well. To do updates and deletes without sending notifications to the attendees, use:

appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);

for updates, and:

appointment.Delete(DeleteMode.SoftDelete, SendCancellationsMode.SendToNone);

my biggest issue before was that I was setting the DeleteMode type to "MoveToDeletedItems" instead of "SoftDelete".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM