How to create an ICS link that creates an outlook appointment using c#

I need a simple function that I can pass something like appointment title, start date and time, and it creates an .ICS link so when the user clicks on it. It will open outlook automatically

I need it to be as simple as possible.

SimbiosAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

khan_webguruCommented:
an example

 
//First thing you need to do is add a reference to Microsoft Outlook 11.0 Object Library. Then, create new instance of Outlook.Application object: 
 
Outlook.Application outlookApp = new Outlook.Application (); 
 
//Next, create an instance of AppointmentItem object and set the properties: 
 
Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem) outlookApp.CreateItem (Outlook.OlItemType.olAppointmentItem);
 
oAppointment.Subject = "This is the subject for my appointment"; 
oAppointment.Body = "This is the body text for my appointment"; 
oAppointment.Location = "Appointment location"; 
 
// Set the start date
oAppointment.Start = Convert.ToDateTime ("10/10/2004 10:00:00 AM");
// End date 
oAppointment.End = Convert.ToDateTime ("10/10/2004 2:00:00 PM");
// Set the reminder 15 minutes before start
oAppointment.ReminderSet = true; 
oAppointment.ReminderMinutesBeforeStart = 15; 
 
//Setting the sound file for a reminder: 
set ReminderPlaySound = true 
//set ReminderSoundFile to a filename. 
 
//Setting the importance: 
//use OlImportance enum to set the importance to low, medium or high
 
oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; 
 
/* OlBusyStatus is enum with following values:
olBusy
olFree
olOutOfOffice
olTentative
*/
oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy; 
 
//Finally, save the appointment: 
 
// Save the appointment
oAppointment.Save (); 
 
// When you call the Save () method, the appointment is saved in Outlook. Another useful method is ForwardAsVcal () which can be used to send the Vcs file via email. 
 
Outlook.MailItem mailItem = oAppointment.ForwardAsVcal (); 
mailItem.To = "recipients email address"; 
mailItem.Send ();

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SimbiosAuthor Commented:
What I want is to create the ICS file link, I have seen that on other site, you click on the .ICS file and it adds the appointment to the calendar
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.