2015-02-24 103 views
0

我有以下代碼,其中SenderName MailItem屬性顯示爲空白。在Application_ItemSend中缺少Outlook MailItem屬性

Private Sub Application_ItemSend(ByVal MyItem As Object, Cancel As Boolean) 
    Dim res As Integer 

    ' The "Class" MailItem property is found 
    If MyItem.Class = olMail Then 

     ' This is coming up blank 
     ' The "SenderName" MailItem property is not apparent 
     MsgBox MyItem.SenderName 

     res = MsgBox("Archive outgoing email?", vbQuestion + vbYesNo, "XYZ") 
     If res = vbYes Then 
      Call ProcessIt(MyItem) 
     Else 
      Cancel = True 
     End If 
    End If 
End Sub 

一些小學生的錯誤也許會和欣賞指針,我失蹤了。

展望2013 Windows 7的

回答

2

發件人相關的屬性被填充後,才真正被髮送並移動到已發送郵件文件夾中的郵件。在Application.ItemSend事件觸發時,消息仍然未發送。

您最早可以訪問發送的消息並填寫所有屬性,該消息位於Sent Itens文件夾的Items.ItemAdd事件中。