如何创建“互联网日历订阅"对于Outlook? [英] How do I create an "internet calendar subscription" for Outlook?

查看:66
本文介绍了如何创建“互联网日历订阅"对于Outlook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,用户添加了一个新的Internet日历",但这是ICS文件的一次性下载.我希望用户单击一个按钮以将其个人日历添加为对Outlook的订阅.我想要自动更新.

Currently, the user adds a "new internet calendar", but it's a one-time download of the ICS file. I want the user to click a button to get his personal calendar added as a subscription to Outlook. I want the automatically updating "internet calendar subscription".

就像在SharePoint中一样,名为连接到Outlook"的按钮会将您正在查看的日历作为自动同步的日历添加到Outlook.

Like in SharePoint, the button called "Connect to Outlook" which adds the calendar you're viewing to your Outlook as an automatically syncing calendar.

推荐答案

在C#此CodeProject帖子告诉我,您应该使用 DDay iCal库.

Creating iCals in C# and this CodeProject post tell me you should use the DDay iCal Library.

DDay.iCal是适用于.NET 2.0及更高版本的iCal(RFC 5545)类库,Silverlight.它旨在尽可能地符合RFC 5545,同时旨在与流行的日历应用程序(如Apple iCal,Outlook 2007等)兼容.

DDay.iCal is an iCal (RFC 5545) class library for .NET 2.0 and above, Silverlight. It aims at being as RFC 5545 compliant as possible, while targeting compatibility with popular calendaring applications, like Apple iCal, Outlook 2007, etc.

某些示例代码 iCal + MVC + DDay.iCal

Some sample code of 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);
}

这篇关于如何创建“互联网日历订阅"对于Outlook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆