Click here to Skip to main content
Click here to Skip to main content
Go to top

Setting up an MS Outlook Appointment C#

, 28 May 2010
Rate this:
Please Sign up or sign in to vote.
This is a simple article describing how to create an add an outlook appointment to your MS Outlook Calender.
Introduction
 
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 // Sets up and creates an outlook calender entry
Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app
Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem); // creates a new appointment
 
Step 3 // Set appointment settings
oAppointment.Subject = "Enquiry Changes made to " + name + "'s enquiry"; // set the subject
oAppointment.Body = "This is where the appointment body of the appointment is written"; // set the body
oAppointment.Location = "Nicks Desk!"; // set the location
oAppointment.Start = Convert.ToDateTime(notesDate); // Set the start date 
oAppointment.End = Convert.ToDateTime(notesDate); // End date 
oAppointment.ReminderSet = true; // Set the reminder
oAppointment.ReminderMinutesBeforeStart = 15; // reminder time
oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; // appointment importance
oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;
 
Step 4 // save the appointment
oAppointment.Save();
 
Step 5 - Check your outlook calender
 
Appointment will now be added to your calender
 
Step 6 // send the details in email
Outlook.MailItem mailItem = oAppointment.ForwardAsVcal(); 
// email address to send to 
mailItem.To = "mailto:me@decodedsolutions.co.uk">me@decodedsolutions.co.uk; 
// send 
mailItem.Send(); 
 
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.
 
Conclusion
 
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DecodedSolutions.co.uk
Software Developer (Junior) DecodedSolutions.co.uk
United Kingdom United Kingdom
We are software developers and we specialise in all software development.
 
Visit Decoded Solutions NOW for all your development needs.

Comments and Discussions

 
QuestionAbout Namesaces Pinmemberalaa bektash30-Nov-13 0:01 
Generalabout the final mail sent with appointment Pinmemberniveditha 200912-Jul-12 10:19 
QuestionI like this, I'm using 14.0 library but this still works Pinmemberdixbear18-Apr-12 5:06 
AnswerRe: I like this, I'm using 14.0 library but this still works Pinmemberniveditha 200912-Jul-12 10:21 
GeneralRe: I like this, I'm using 14.0 library but this still works Pinmemberzemuss12-Aug-12 9:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 28 May 2010
Article Copyright 2010 by DecodedSolutions.co.uk
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid