title: How do I create an Outlook "appointment" with DDay.iCal?
body: <p>I'm using the DDay library to create an iCal event, so that users of my site can add something to their calendar.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <pre><code>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&lt;Event&gt;();
      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);
  }
  </code></pre>