This is a simple article describing how to create an add an outlook appointment to your MS Outlook Calender.
Using the code
This article has been made as straight forward as possible for you, simple follow the steps (1-7) and in no time you should have the app up and running. You can find a full example (With screen shots for importing reference) included in the download file.
Step 1 - Import the outlook reference
The first thing that you need to do is add a reference to the Microsoft Outlook 12.0 Object Library.
1.1. [Right click] on your [Project solution] – [Click] on [Add reference]
1.2. [Click] on the [COM] tab – Scroll down until you find Microsoft Outlook 12.0
1.3 [Click] OK
Step 2 Outlook.Application outlookApp = new Outlook.Application(); Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
Step 3 oAppointment.Subject = "Enquiry Changes made to " + name + "'s enquiry"; oAppointment.Body = "This is where the appointment body of the appointment is written"; oAppointment.Location = "Nicks Desk!"; oAppointment.Start = Convert.ToDateTime(notesDate); oAppointment.End = Convert.ToDateTime(notesDate); oAppointment.ReminderSet = true; oAppointment.ReminderMinutesBeforeStart = 15; oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;
Step 4 oAppointment.Save();
Step 5 - Check your outlook calender
Appointment will now be added to your calender
Step 6 Outlook.MailItem mailItem = oAppointment.ForwardAsVcal();
mailItem.To = "mailto:email@example.com">firstname.lastname@example.org;
Step 7 - Finished
Your appointment will now have been created and added to your outlook calender. An email will have also been sent to the address you specified.
Now that we have created the mailItem, not only will the appointment be added to your calendar, but an email sent to an address of your choice.
This small application is very useful and can save you a lot of time and effort. It is well worth implementing as a standalone app or as an add on to an existing one.
Thanks Nick Austin DecodedSolutions