outlook2010 VSTO addin转发邮件问题

时间:2015-08-05 09:34:45

标签: c# vsto outlook-addin

是Outlook加载项中的新功能。我只是使用c#创建加密和解密加载项。 现在我遇到了一个问题,当我解密电子邮件时,它通过mailitem_open函数成功打开。然后单击转发选项并发送电子邮件。然后关闭窗口,在解密模式下显示的实际消息不在加密模式中。请帮帮我

1 个答案:

答案 0 :(得分:0)

单击“前进”按钮或只需调用Forward方法时,将创建/返回新项目。您需要在发送/保存之前对其进行加密。例如:

Sub RemoveAttachmentBeforeForwarding()  
 Dim myinspector As Outlook.Inspector 
 Dim myItem As Outlook.MailItem 
 Dim myattachments As Outlook.Attachments 
 Set myinspector = Application.ActiveInspector 
 If Not TypeName(myinspector) = "Nothing" Then 
  Set myItem = myinspector.CurrentItem.Forward 
  Set myattachments = myItem.Attachments 
  While myattachments.Count > 0 
   myattachments.Remove 1 
  Wend 
  myItem.Display 
  myItem.Recipients.Add "Eugene Astafiev" 
  myItem.Send 
 Else 
  MsgBox "There is no active inspector." 
 End If 
End Sub