Hello, avi,
In order to send cancel event request, you have to first save the message to file, then load the calendar and create the cancel request. Please try the sample and hotfix, let me know if it works.
Here is the sample code:
1. First send the meeting request and save the message to file
//send meeting request
MailMessage msg = new MailMessage();
msg.From = "organizer@domain.com";
//attendees for the event
MailAddressCollection attendees = new MailAddressCollection();
attendees.Add(new MailAddress("attendee1@domain.com"));
attendees.Add(new MailAddress("attendee2@domain.com"));
msg.To = attendees;
//create calendar
Calendar cal = new Calendar("Room 113", new DateTime(2008, 8, 25, 15, 0, 0), new DateTime(2008, 8, 25, 16, 0, 0), msg.From, attendees);
cal.Summary = "Release Meetting 113";
cal.Description = "Discuss for the next release";
//add calendar to the message
msg.AddCalendar(cal);
msg.Save("message.eml");
//send the email message
SmtpClient smtp = new SmtpClient("smtp.server.com","user","password");
smtp.Send(msg);
2. Load the message files and get the calendar information.
//load the mail message
MailMessage msg = MailMessage.Load("message.eml");
//get the meeting calendar from the message
msg.AlternateViews[0].Save(@"meeting.ics");
3. Create cancel calendar object from the ics files, add it to MailMessage Object's AlternativeViews
//create cancel request based on the meeting request
AlternateView v = Calendar.CreateCancelRequestFrom(@"meeting.ics");
msg = new MailMessage();
msg.AlternateViews.Add(v);
msg.Subject = "Cancel: Release Meetting 113";
msg.From = "organizer@domain.com";
//attendees for the event
MailAddressCollection attendees = new MailAddressCollection();
attendees.Add(new MailAddress("attendee1@domain.com"));
attendees.Add(new MailAddress("attendee2@domain.com"));
msg.To = attendees;
SmtpClient smtp = new SmtpClient("smtp.server.com","user","password");
smtp.Send(msg);
Team Lead
Aspose Guangzhou Team
About UsContact Us