我想制作一个 VB.NET Outlook 插件,让用户自动创建所选邮件的转发(预先填充指定的电子邮件地址/主题行),显示它以供审阅,然后在用户成功发送转发后,将特定类别添加到原来的消息,例如“已处理”。如果用户关闭转发而不发送它,那么原始转发不会发生任何事情。
我有良好的回复生成功能和类别设置功能——我完全不知道如何有效地暂停子邮件的执行,直到转发被发送或取消/关闭,然后根据转发的处理方式对原始电子邮件采取不同的后续操作。
我的代码如下:
Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
Dim itm As Outlook.MailItem
Dim fwd As Outlook.MailItem
Try
itm = Globals.ThisAddIn.Application.ActiveInspector.CurrentItem
Catch ex As Exception
Exit Sub
End Try
fwd = itm.Forward
fwd.Recipients.Add("<email address here>")
fwd.Subject = "Test Email"
fwd.Display()
'more code here that waits for forward "fwd" message to be disposed of and then branches
'to handle the original "itm" message differently depending on how the "fwd" was disposed
'of...
itm.categories = "Processed"
itm.save()
End Sub
任何帮助都将非常感激。
谢谢。