How to create an "online calendar subscription" for Outlook?

The user is currently adding a “new online calendar,” but this is a one-time download of the ICS file. I want the user to click a button to add their personal calendar as an Outlook subscription. I want to automatically renew my online calendar subscription .

Like in SharePoint, the “Connect to Outlook” button, which adds the calendar that you are viewing in Outlook, is like an automatic synchronization calendar.

+4
source share
1 answer

Creating iCals in C # and this CodeProject post say you should use the DDay iCal library .

DDay.iCal is the iCal class library (RFC 5545) for .NET 2.0 and higher, Silverlight. It aims to be as compatible with RFC 5545 as possible, while focusing on compatibility with popular calendar applications such as Apple iCal, Outlook 2007, etc.

Some sample code iCal + MVC + DDay.iCal

public ActionResult iCalendar(string DownloadFileName) { DDay.iCal.iCalendar iCal = new DDay.iCal.iCalendar(); Event evt = iCal.Create<Event>(); evt.Start = iCalDateTime.Today.AddHours(8); evt.End = evt.Start.AddHours(18); // This also sets the duration evt.Description = "The event description"; evt.Location = "Event location"; evt.Summary = "18 hour event summary"; evt = iCal.Create<Event>(); evt.Start = iCalDateTime.Today.AddDays(5); evt.End = evt.Start.AddDays(1); evt.IsAllDay = true; evt.Summary = "All-day event"; ISerializationContext ctx = new SerializationContext(); ISerializerFactory factory = new DDay.iCal.Serialization.iCalendar.SerializerFactory(); IStringSerializer serializer = factory.Build(iCal.GetType(), ctx) as IStringSerializer; string output = serializer.SerializeToString(iCal); var contentType = "text/calendar"; var bytes = Encoding.UTF8.GetBytes(output); return File(bytes, contentType, DownloadFileName); } 
+4
source

Source: https://habr.com/ru/post/1483347/


All Articles