如何创建一个Outlook"任命"与DDay.iCal? [英] How do I create an Outlook "appointment" with DDay.iCal?
问题描述
我使用的DDAY库创建一个iCal事件,让我的网站的用户可以添加一些自己的日历。
我希望他们能够添加预约,而不是在Office 2010中(希望别人太)的会议要求。当我使用的库和设置方法进行发布,它似乎为预约,但报告说,本次会议不能在日历中找到。后来,当我需要点击没有反应,该项目被删除,不留在自己的日历中。
如果我改变方法请求时,它显示为一个会议请求。这一个不错的次优选择,但到字段为空。如果这是我能做的最好的,我怎么可以把'到'字段?我想我不应该把自己回应。
私有静态字符串CreateCalendarEvent(
字符串的标题,绳体,日期时间的startDate,双期限,
字符串的位置,串组织者,串EVENTID,布尔allDayEvent)
{
//强制展望2007
如果(String.IsNullOrEmpty(组织者))
抛出新的异常(组织者提供的为空); VAR的iCal =新的iCalendar
{
方法=发布,
版本=2.0
}; //要求将更新相同的UID(唯一ID)和更新的时间戳现有事件。
//如果(更新previousEvent)
// {
// iCal.Method =请求;
//} VAR EVT = iCal.Create<事件>();
evt.Summary =称号;
evt.Start =新iCalDateTime(的startDate);
evt.Duration = TimeSpan.FromHours(持续时间);
evt.Description =身体;
evt.Location =位置;
evt.IsAllDay = allDayEvent;
evt.UID = String.IsNullOrEmpty(事件ID)?新的GUID()的ToString():事件ID。
evt.Organizer =新的主办单位(主办单位);
evt.Alarms.Add(新报警
{
持续时间=新时间跨度(0,15,0),
触发=新触发(新时间跨度(0,15,0)),
行动= AlarmAction.Display,
说明=提醒
}); 返回新iCalendarSerializer()SerializeToString(iCal中)。
}
当我设置了组织者的电子邮件地址,而不是一个测试字符串,它工作得很好。我写了这一切,所以我想我会在任何情况下,分享别人有同样的问题。
I'm using the DDay library to create an iCal event, so that users of my site can add something to their calendar.
I want them to add an appointment as opposed to a meeting request in Office 2010 (and hopefully others too). When I use the library and set the method to PUBLISH, it does appear as an appointment, but it reports that the meeting cannot be found in the calendar. Then when I click no response required, the item gets deleted and doesn't stay in their calendar.
If I change the method to REQUEST, it shows up as a meeting request. This would an okay second best option, but the 'to' field is blank. If that's the best I can do, how can I set the 'to' field? I guess I would have them respond to themselves.
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);
}
When I set the organizer to an email address, as opposed to a test string, it worked fine. I had written all of this up, so I thought I'd share it in case anyone else had the same problem
这篇关于如何创建一个Outlook&QUOT;任命&QUOT;与DDay.iCal?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!