The problem was the METHOD
was not specified within the appointemt data and entity's Content-Type. This code works with my Outlook 2010. Please give it a try.
static string ConstructVCalendar(string from, string to, DateTime start, DateTime end, string summary, string description, string location)
{
StringBuilder sb = new StringBuilder();
sb.Append("BEGIN:VCALENDAR\n");
sb.Append("METHOD:REQUEST\n");
sb.Append("VERSION:2.0\n");
sb.Append("PRODID:Rebex Mail\n");
sb.Append("BEGIN:VEVENT\n");
sb.AppendFormat("DTSTAMP:{0}\n", DateTime.Now.ToUniversalTime().ToString(@"yyyyMMdd\THHmmss\Z"));
sb.AppendFormat("UID:{0}\n", Guid.NewGuid());
sb.AppendFormat("ORGANIZER:MAILTO:{0}\n", from);
sb.AppendFormat("ATTENDEE;RSVP=TRUE:MAILTO:{0}\n", to);
sb.AppendFormat("DTSTART:{0}\n", start.ToUniversalTime().ToString(@"yyyyMMdd\THHmmss\Z"));
sb.AppendFormat("DTEND:{0}\n", end.ToUniversalTime().ToString(@"yyyyMMdd\THHmmss\Z"));
sb.Append("CATEGORIES:MEETING,PROJECT\n");
sb.Append("CLASS:PUBLIC\n");
sb.AppendFormat("SUMMARY:{0}\n", summary);
sb.AppendFormat("DESCRIPTION:{0}\n", description);
sb.AppendFormat("LOCATION:{0}\n", location);
sb.Append("END:VEVENT\n");
sb.Append("END:VCALENDAR\n");
return sb.ToString();
}
// ...
string from = "organizer@host.com";
string to = "attendee@host.cz";
DateTime start = new DateTime(2011, 2, 28, 10, 30, 0, DateTimeKind.Local);
DateTime end = start.AddHours(2); // duration is 2 hours
// appointment data - see http://tools.ietf.org/html/rfc2445 for details
string appointmentData = ConstructVCalendar(from, to, start, end, "My summary", "My description", "My location");
// construct the calendar entity
MimeMessage appointment = new MimeMessage();
appointment.SetContent(appointmentData, "text/calendar");
appointment.ContentType.Parameters.Add("method", "REQUEST");
appointment.From = from;
appointment.To = to;
Smtp.Send(appointment, "SMTP.server.name");
Please note the line sb.AppendFormat("UID:{0}\n", Guid.NewGuid());
This UID
can be used lately to change this appointemnt.