I use the DDay library to create an iCal event so that users on my site can add something to their calendar.
I want them to add a meeting, not a meeting request in Office 2010 (and hopefully others). When I use the library and set the method to PUBLISH, it appears as a meeting, but reports that the meeting cannot be found on the calendar. Then, when I do not require a response, the item is deleted and does not remain on the calendar.
If I changed the method to a request, it will appear as a meeting invitation. This will be the best second option, but the 'to' field is empty. If this is the best I can do, how can I set the 'to' field? I probably would have answered that they would 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); }
Hoppe
source share