问题
Obviously in outlook, one is able to create an appointment in a public folder and invite people (including yourself) - i want to replicate this with exchange web services.
i can create an event in my own calendar and invite people and that works fine. if i create an event in a public folder and invite people, in the createitem object the SendMeetingInvitationsOrCancellations must be set to SendToNone, otherwise it throws this error:
Meeting invitations or cancellations cannot be sent for calendar items residing in public folders.
which of course means that no invitations get sent. on this calendar item in outlook, if i click invite attendees the names are there that i've put in via the webservice call. i could, for instance, then manually send the invitations from outlook, but of course i want this to be all automated.
should i be doing it this way? it seems crazy that for some reason ews wouldn't allow you to do something you're able to do in outlook...?
回答1:
I'm doing a similar task in an application to add holiday to user calendars, but I used appointment instead of calendar, which is created for the current authenticated user and then sent to a specific set of user.
The application is written in C#, but you should be able to translate the idea.
Appointment appointment = new Appointment(getExchangeService());
appointment.Subject = "Test meeting";
appointment.Start = DateTime.Now;
appointment.End = DateTime.Now.AddHours(2);
foreach (String emailAddress in attendees)
{
appointment.RequiredAttendees.Add(emailAddress);
}
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
来源:https://stackoverflow.com/questions/505978/invite-attendees-to-public-calendar-event-in-exchange-web-services