I'm creating an application using the ASP.NET MVC 1 framework in C#, where I have users that register for events. Upon registering, I create an outlook meeting request
public string BuildMeetingRequest(DateTime start, DateTime end, string attendees, string organizer, string subject, string description, string UID, string location)
{
System.Text.StringBuilder sw = new System.Text.StringBuilder();
sw.AppendLine("BEGIN:VCALENDAR");
sw.AppendLine("VERSION:2.0");
sw.AppendLine("METHOD:REQUEST");
sw.AppendLine("BEGIN:VEVENT");
sw.AppendLine(attendees);
sw.AppendLine("CLASS:PUBLIC");
sw.AppendLine(string.Format("CREATED:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
sw.AppendLine("DESCRIPTION:" + description);
sw.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", end));
sw.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
sw.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", start));
sw.AppendLine("ORGANIZER;CN=\"NAME\":mailto:" + organizer);
sw.AppendLine("SEQUENCE:0");
sw.AppendLine("UID:" + UID);
sw.AppendLine("LOCATION:" + location);
sw.AppendLine("SUMMARY;LANGUAGE=en-us:" + subject);
sw.AppendLine("BEGIN:VALARM");
sw.AppendLine("TRIGGER:-PT720M");
sw.AppendLine("ACTION:DISPLAY");
sw.AppendLine("DESCRIPTION:Reminder");
sw.AppendLine("END:VALARM");
sw.AppendLine("END:VEVENT");
sw.AppendLine("END:VCALENDAR");
return sw.ToString();
}
And once built, I use MailMessage, with an alternate view to send out the meeting request:
meetingInfo = BuildMeetingRequest(start, end, attendees, organizer, subject, description, UID, location);
System.Net.Mime.ContentType mimeType = new System.Net.Mime.ContentType("text/calendar; method=REQUEST");
AlternateView ICSview = AlternateView.CreateAlternateViewFromString(meetingInfo,mimeType);
MailMessage message = new MailMessage();
message.To.Add(to);
message.From = new MailAddress(from);
message.AlternateViews.Add(ICSview);
SmtpClient client = new SmtpClient();
client.Send(message);
When users get the email in outlook, it shows up as a meeting request, as opposed to a normal email.
This works well for sending out updates to the meeting request as well. The only problem that I am having is that I do not know the proper format for sending out a cancellation. I've attempted to examine some meeting request cancellations in text editors and can't seem to pinpoint the difference in the format between cancelling/creating.
Any help on this is greatly appreciated.
Deleting a Meeting: In Outlook at the bottom of the screen, click Calendar. For appointments or meetings you didn't organize, right-click and select Delete. For recurring appointments or meetings, you can choose to delete the Occurrence or the Series.
Click the 'Edit' button. The meeting details screen will open. Click the 'Cancel Meeting' button towards the top left corner.
According to RFC 2445 you just need to set STATUS:CANCELLED
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With