【问题标题】:How do I create an Outlook "appointment" with DDay.iCal?如何使用 DDay.iCal 创建 Outlook“约会”?
【发布时间】:2012-08-24 15:25:40
【问题描述】:

我正在使用 DDay 库来创建 iCal 活动,以便我网站的用户可以在他们的日历中添加一些内容。

我希望他们添加约会而不是 Office 2010 中的会议请求(希望其他人也添加)。当我使用库并将方法设置为 PUBLISH 时,它确实显示为约会,但报告在日历中找不到会议。然后,当我单击不需要响应时,该项目将被删除并且不会保留在他们的日历中。

如果我将方法更改为 REQUEST,它会显示为会议请求。这将是第二好的选择,但“to”字段为空白。如果这是我能做的最好的,我该如何设置“到”字段?我想我会让他们自己回应。

private static string CreateCalendarEvent(
    string title, string body, DateTime startDate, double duration, 
    string location, string organizer, string eventId, bool allDayEvent)
{
    // mandatory for outlook 2007
    if(String.IsNullOrEmpty(organizer))
        throw new Exception("Organizer provided was null");

    var iCal = new iCalendar
    {
        Method = "PUBLISH",
        Version = "2.0"
    };

    // "REQUEST" will update an existing event with the same UID (Unique ID) and a newer time stamp.
    //if (updatePreviousEvent)
    //{
    //    iCal.Method = "REQUEST";
    //}

    var evt = iCal.Create<Event>();
    evt.Summary = title;
    evt.Start = new iCalDateTime(startDate);
    evt.Duration = TimeSpan.FromHours(duration);
    evt.Description = body;
    evt.Location = location;
    evt.IsAllDay = allDayEvent;
    evt.UID = String.IsNullOrEmpty(eventId) ? new Guid().ToString() : eventId;
    evt.Organizer = new Organizer(organizer);
    evt.Alarms.Add(new Alarm
    {
        Duration = new TimeSpan(0, 15, 0),
        Trigger = new Trigger(new TimeSpan(0, 15, 0)),
        Action = AlarmAction.Display,
        Description = "Reminder"
    });

    return new iCalendarSerializer().SerializeToString(iCal);
}

【问题讨论】:

    标签: c# asp.net icalendar dday


    【解决方案1】:

    当我将管理器设置为电子邮件地址而不是测试字符串时,它工作正常。我已经写了所有这些,所以我想我会分享它以防其他人遇到同样的问题

    【讨论】:

    • 请注意,如果您稍后进入并将其更新为会议请求,则该电子邮件实际上并未用于任何用途。
    【解决方案2】:

    当 Exchange 服务器从 2003 年升级到 Outlook 2010 时,我的应用程序停止工作。在升级之前 PUBLISH 工作正常,但现在我不得不更改为 REQUEST

    感谢您的文章

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-13
      • 2013-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-20
      相关资源
      最近更新 更多