Missing Outlook MailItem Properties in Application_ItemSend

江枫思渺然 提交于 2019-12-25 04:28:10

问题


I have the code below in which the SenderName MailItem property appears blank.

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

Some schoolboy error perhaps and will appreciate pointers as to what I am missing.

Outlook 2013 Windows 7


回答1:


Sender related properties are populated only after the message is actually sent and moved to the Sent Items folder. By the time Application.ItemSend event fires, the message is still unsent.

The earliest you can access the sent message with all the properties populated is in the Items.ItemAdd event on the Sent Itens folder.



来源:https://stackoverflow.com/questions/28698291/missing-outlook-mailitem-properties-in-application-itemsend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!