Sie sind auf Seite 1von 2

Setting up an MS Outlook Appointment C#

DecodedSolutions.co.uk This is a simple article describing how to create an add an outlook appointment to your MS Outlook Calender. Vote
Vote

See more:SQL2005C++CC#SQLOutlook 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
Collapse | Copy Code

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
Collapse | Copy Code

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;
Collapse | Copy Code

Step 4 // save the appointment oAppointment.Save();

Step 5 - Check your outlook calender Appointment will now be added to your calender
Collapse | Copy Code

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
Improve tip/trick Permalink Posted 27 May '10 DecodedSolutions.co.uk456 Edited 27 May '10 v2 |

Das könnte Ihnen auch gefallen