2014-09-24 42 views
0

我正在使用VSTO开发Outlook的加载项。禁用向所有与会者发送更新VSTO

使用Send方法MeetingItemAppointmentItem)时,如何禁用发送更新到所有与会者弹出?当我打电话给现有会议的Send时,它总是显示。

我只发现ForceUpdateToAllAttendees属性,但它会将更新发送给所有与会者,如果用户不想将更新发送给所有与会者,则会发生错误。

编辑:

这是我的代码

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

... 在SC01形式:

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 
} 
+0

如果用户SHLL能够决定是否更新发送到每个人,那么你为什么不喜欢弹出窗口? – Max 2014-09-25 11:18:53

+0

实际上,当用户点击发送按钮,然后选择发送选项,一个确认弹出窗口会出现。如果用户在这个弹出窗口上单击OK,将会调用Send()函数实际发送该项目。此时,发送选项弹出窗口再次出现,不是我想要的。 – 2014-09-25 15:43:02

+0

如何确认弹出窗口?你的发送按钮是否已经调用发送程序或其他东西? – Max 2014-09-25 16:39:40

回答

0

抱歉,我走了几天。我想我有解决方案,althuogh我只“说” VBA - 但最终它都一样...

告辞而去行:

Cancel = true; // prevent mail sending 

也行:

meetingItem.GetAssociatedAppointment(false).Send(); 

据我所知,只要窗体不再被隐藏,该项目将不会被发送。

我希望这个作品! 最大

+0

是的我知道,如果窗体是'ShowDialog',它将阻止邮件发送。但是我的表单正在使用'Show'而不是... – 2014-09-30 00:01:38

+0

也许这对了解你最终的目标有所帮助。为什么它必须是“显示”,而不是“showdialog” – Max 2014-09-30 06:43:16

+0

在vba。显示也停止宏,直到表单被再次隐藏... – Max 2014-09-30 06:45:45

0

刚刚应该解决您的问题换个思路:

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 
} 

...在SC01形式:

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 
} 
+0

对不起,我太忙无法检查你的答案。我试过了,但是如果在Send()之前'ForceUpdateToAllAttendees'是'false',弹出窗口会出现。只有'ForceUpdateToAllAttendees'为'true',弹出窗口才会显示。 – 2014-10-09 03:40:54