0

I'm using VSTO to develop add-in for Outlook.

When using Send method of MeetingItem (AppointmentItem), how can I disable Send Update to All Attendees popup? It always show when I call Send of existing meeting.

I only found ForceUpdateToAllAttendees property but it make the update send to all attendees, that would be wrong if user don't want to send updates to all attendees.

EDIT:

This is my code

void Application_ItemSend(object item, ref bool Cancel)
{
    var form = new SC01(item);
    form.Show();
    Cancel = true; // prevent mail sending
}

... in SC01 form:

private void btn_OK_Click(object sender, EventArgs e)
{
    var meetingItem = _item As MeetingItem;    // _item is private field of SC01
    meetingItem.GetAssociatedAppointment(false).Send(); // this Send() will make sending option (to update attendees only or to all attendees
}
Thanhma San
  • 1,347
  • 2
  • 8
  • 12
  • if the user shll be able to decide if the update is sent to everyone, then why don't you like the popup? – Max Sep 25 '14 at 11:18
  • Actually, when user click on Send button, then choose sending option, a confirmation popup will appear. If user click OK on this popup, `Send()` function will be called to actually send the item. At this time, the sending option popup appear again, that not I want. – Thanhma San Sep 25 '14 at 15:43
  • How is the confirmation pop-up called? And is your send-button calling the send-procedure already or something else? – Max Sep 25 '14 at 16:39
  • When user click on Outlook Send button, it will enter `ItemSend` event of application (send procedure already called), I set `Cancel = true` for not sending the mail, then display popup form. And in my popup, when user click OK, `meetingItem.Send()` method will be called. – Thanhma San Sep 25 '14 at 23:02
  • please post your code, I think I have a solution, whuich is easier to explain with your code. – Max Sep 26 '14 at 06:40
  • @Max, I updated my post with code. Please take a look. – Thanhma San Sep 26 '14 at 07:37

2 Answers2

0

sorry I was away some days. I think I have the solution, althuogh I only "speak" vba - but in the end it is all the same...

leave away the line:

Cancel = true; // prevent mail sending

and also the line:

meetingItem.GetAssociatedAppointment(false).Send(); 

as far as I know the item will not be sent anyway as long as the form is not hidden again.

I hope this works! Max

Max
  • 744
  • 1
  • 7
  • 19
  • Yes I know, if the form is `ShowDialog`, it will prevent mail sending. But my form is using `Show` instead... – Thanhma San Sep 30 '14 at 00:01
  • maybe it would be helpful to know what you are aiming to do in the end. why does it have to be "Show" and not "showdialog" – Max Sep 30 '14 at 06:43
0

just had another idea that should solve your Problem:

void Application_ItemSend(object item, ref bool Cancel)
{
    var form = new SC01(item);
    form.Show();
   '''next line is new and prevents the first popup
      item.ForceUpdateToAllAttendees = TRUE
    Cancel = true; // prevent mail sending
}

... in SC01 form:

private void btn_OK_Click(object sender, EventArgs e)
{
    var meetingItem = _item As MeetingItem;    // _item is private field of SC01
   '''next line is new => popup Comes now
      meetingItem.ForceUpdateToAllAttendees = FALSE
    meetingItem.GetAssociatedAppointment(false).Send(); // this Send() will make sending option (to update attendees only or to all attendees
}
Max
  • 744
  • 1
  • 7
  • 19
  • Sorry I was too busy to check your answer. I've tried but if `ForceUpdateToAllAttendees` is `false` before `Send()`, the popup appears. Only if `ForceUpdateToAllAttendees` is `true`, the popup will not show. – Thanhma San Oct 09 '14 at 03:40