Pregunta

I'm implementing an Outlook plugin and I need to create appointments by code, the appointments I want to model occur in rooms, rooms live in Outlook Exchange. How can I add various rooms to the appointment created by code, consider the following code to create an appointment:

Outlook.AppointmentItem newAppointment =
    (Outlook.AppointmentItem)
this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem);
newAppointment.Start = DateTime.Now.AddHours(2);
newAppointment.End = DateTime.Now.AddHours(3);
newAppointment.Location = "SOME_LOCATION";
newAppointment.Body =
    "We will discuss progress on the group project.";
newAppointment.AllDayEvent = false;
newAppointment.Subject = "Group Project";
newAppointment.Recipients.Add("Roger Harui");

Outlook.Recipients sentTo = newAppointment.Recipients;
Outlook.Recipient sentInvite = null;

sentInvite = sentTo.Add("Holly Holt");
sentInvite.Type = (int)Outlook.OlMeetingRecipientType
    .olRequired;

sentInvite = sentTo.Add("David Junca ");
sentInvite.Type = (int)Outlook.OlMeetingRecipientType
    .olOptional;

sentTo.ResolveAll();
newAppointment.Save();

newAppointment.Recipients.ResolveAll();
newAppointment.Display(true);
¿Fue útil?

Solución

You add a room the same way you add an attendee - pass the name of the room to Recipients.Add and set the Recipient.Type property to olResource (3).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top