I am developing a plugin for outlook using c# vsto. When i send the invitation it works properly as i need. Here is the my code.
private void ThisAddIn_Startup(object sender, EventArgs e)
{
Application.ItemSend += Application_ItemSend;
}
private void Application_ItemSend(object item, ref bool cancel)
{
if (item is MeetingItem meetingItem)
{
cancel = true;
meetingItem.GetAssociatedAppointment(false).Close(OlInspectorClose.olSave);
}
}
Here I am preventing outlook from sending the appointment but still saving it. And this works fine for the case when meetingItem.Class is equal to OlObjectClass.olMeetingRequest. But the problem occurs when the user wants to accept(edit the response before sending) or decline(send the response now) the invitation, because the same method is called, but the meetingItem.Class is already equal to either OlObjectClass.olMeetingResponsePositive or olMeetingResponseNegative. What can I do to make outlook not send a response for accepting or declining an invitation, but still save it?
1