Free Support Forum - aspose.com

Cancel Appointment

Hi, I am using this method to cancel auupointment:

Aspose.Network.Mail.MailMessage msg = new Aspose.Network.Mail.MailMessage();

// Set key Appointment fields

// Subject is set on message here

msg.From = schedulerEmail;

msg.To = attendees;

msg.Subject = subject;

msg.Body = body.ToString();

//use Appointment class instead

Aspose.Network.Mail.Appointment appointment = new Aspose.Network.Mail.Appointment(location, finalStartDate, finalEndDate, schedulerEmail, attendees);

appointment.UniqueId = appointmentRequestId.ToString();

msg.AddAlternateView(appointment.CancelAppointment(2));

The problem is that the system sends one email for cancelling the appointment, and another one that seems to try to recreate the appointment, dated a few minutes earlier than the cancellation one. what can I do?

Thanks

Hi,

I am sorry, I cannot reproduce this issue at my end. Could you please try to exclude any argument in CancelAppointment() method and see if it works correctly.

Below is the code snippet that I tested:

// setup appointment
MailAddressCollection attendees = new MailAddressCollection();
attendees.Add("person1@gmail.com");
attendees.Add("person2@msn.com");
Appointment app = new Appointment(“Location”, DateTime.Now, DateTime.Now.AddHours(1), new MailAddress("sender@domain.com"), attendees);

// setup message that needs to be sent
MailMessage msg = new MailMessage();
msg.From = "sender@domain.com";
msg.To = "person1@gmail.com"; // only send to gmail
msg.Subject = “appointment request”;
msg.Body = “you are invited”;
msg.AddAlternateView(app.RequestApointment());

// setup smtp client to send email
SmtpClient client = new SmtpClient(“smtpserver”, port, "sender@domain.com", “pwd”);
client.Send(msg);

MessageBox.Show(“Appointment request sent. Press OK to cancel the appointment.”);

Appointment appCancel = new Appointment(app.Location, app.StartDate, app.EndDate, app.Organizer, app.Attendees);
appCancel.UniqueId = app.UniqueId;
MailMessage msgCancel = new MailMessage(msg.From, msg.To);
msgCancel.Subject = “Cancel appointment”;
msgCancel.Body = “cancel appointment”;
msgCancel.AddAlternateView(appCancel.CancelAppointment());
client.Send(msgCancel);

I tried the Cancel methos without arguments, the outcome is the same:

Here is a doc with my emails generated when I create, update and then delete the appointment:

When I create an appt I receive one email

Updating - receive another email

Cancel appointment: still two emails, one with the X icon and whn I hoover over it the tooltip says' Meeting cancelled"

The second one has a different icon - the tooltip says 'Appointment', but is the exact content as the other one.SO, the Cancel appointment sends a 'Meeting Cancelled' and an appointment.

Thansk for your help

I am sorry, I tried with both v4.8.0 and 4.8.1, but still could not reproduce this bug. For sending the request, I get 1st email and for canceling, I get 2nd email. No other email is being sent.

Could you please debug your application and check if MailMessage.Send() is being called twice for canceling the appointment?