Search code examples
c#emailcalendaroutlookicalendar

.ics file to save to outlook calendar automatically when the email it is attatched to is opened


I was just wondering if anyone has found of or knows a way of getting a .ics file to save to outlook calendar automatically when the email it is attatched to is opened without using the Microsoft.Office.Interop.Outlook; reference. the reason i dont want to use the outlook appointment object is because i believe it can cause problems if outlook is not already runnning.

i create the .ics file in a string builder and attatch it to a mail message but have been unable to figure out a way for it to save to the calendar when the email is opened.

i'm basically loooking for a different way of getting the same effect as Appointment.Save();

Any help would be much appreciated.


Solution

  • Hiky, It cannot (and should not) be done. As Andreas points out that would be abused straight away by the unscrupulous.

    If this is for a select intended audience, perhaps the way to handle it would be to provide instructions for various popular devices on how to "subscribe" to the calendar feed (not import as there is a difference)

    Import a calendar

    Import a ics file means that one imports the events as they are defined in the calendar file. There is no syncing or updates. One can import a set of events into an existing calendar.

    Subscribe to a calendar

    Subscribing means telling the calendar application the url of the calendar. It will then fetch the calendar at regular intervals, checking for updates. The calendar must be available publicly, and in Google’s case, there must be a robots.txt file that allows access for the google bot. Usually this would appear as a separate calendar in one’s calendar application, allowing one to “click” the calendar off or on.