【问题标题】:How do I create an "internet calendar subscription" for Outlook?如何为 Outlook 创建“互联网日历订阅”?
【发布时间】:2013-05-29 11:41:10
【问题描述】:

目前,用户添加了一个“新的互联网日历”,但它是 ICS 文件的一次性下载。我希望用户单击一个按钮以将他的个人日历添加为 Outlook 订阅。我想要自动更新"internet calendar subscription"

与 SharePoint 中一样,名为“连接到 Outlook”的按钮将您正在查看的日历作为自动同步日历添加到 Outlook。

【问题讨论】:

    标签: asp.net-mvc-4 outlook icalendar


    【解决方案1】:

    Creating iCals in C#this CodeProject post 告诉我你应该使用DDay iCal Library

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

    iCal + MVC + DDay.iCal 的一些sample code

    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 提供了 ics 文件。问题是用户必须通过从互联网添加日历 => 在 Outlook 中手动添加链接。我试图通过单击一个按钮来解决这个问题。我还找到了 dday ical,这就是我们现在生成 ics 文件的方式。
    • 也许这个修补程序可以提供帮助。 stackoverflow.com/questions/4349836/… 因为当你点击ical时,它应该默认在outlook中打开(当然如果安装了)
    • 问题不在于outlook打不开。问题是我想添加一个 INTERNET 日历,而不仅仅是一个一次性的 ics 文件。当我让它手动生成并添加 ics 文件时,我不再获得互联网更新。
    • 我不明白这如何帮助我将它变成一个互联网日历。您能否解释一下 .ics 和 .ical 之间的区别是什么?我在本地测试项目上切换了它,结果完全没有改变。
    • 如果您在此 url 上添加 ORGANIZER stackoverflow.com/questions/4137437/… 更多 stackoverflow.com/questions/12112323/… 应该可以工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-07
    • 2023-01-14
    • 1970-01-01
    • 1970-01-01
    • 2021-04-30
    • 2016-06-04
    • 1970-01-01
    相关资源
    最近更新 更多