I want to create a program which makes it possible to create an appointment in someone else's outlook calendar. For example : If someone asks their boss for five days free, their boss needs to be able to approve it and immediately make it visible in the person's outlook calendar. I already made some code in which allows you to set your own appointments. here is my code:
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
AddAppointment("ConferenceRoom #2345", "We will discuss progression the group project.", "Group Project", new DateTime(2016, 02, 23, 15, 30, 52), new DateTime(2016, 02, 23, 20, 30, 52));
}
private void AddAppointment(string location, string body, string subject, DateTime startdatum, DateTime einddatum)
{
try
{
var AppOutlook = new Outlook.Application();
Outlook.AppointmentItem newAppointment =
(Outlook.AppointmentItem)
AppOutlook.CreateItem(Outlook.OlItemType.olAppointmentItem);
newAppointment.Start = startdatum;
newAppointment.End = einddatum;
newAppointment.Location = location;
newAppointment.Body = body;
newAppointment.BusyStatus=Outlook.OlBusyStatus.olTentative;
newAppointment.AllDayEvent = true;
newAppointment.Subject = subject;
newAppointment.Save();
newAppointment.Display(true);
}
catch (Exception ex)
{
MessageBox.Show("The following error occurred: " + ex.Message);
}
}
PS: Sorry if my english isn't great.