Folder.Items中缺少发件人,SenderEmailAddress [英] Sender, SenderEmailAddress Missing in Folder.Items

查看:131
本文介绍了Folder.Items中缺少发件人,SenderEmailAddress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Outlook电子邮件中下载附件.

I want to download attachments from Outlook emails.

这是我用来检索电子邮件的代码.

Here is the code I am using to retrieve emails.

Set OutlookApp = New Outlook.Application
Set OutlookNamespace = OutlookApp.GetNamespace("MAPI")
Set Folder = OutlookNamespace.GetDefaultFolder(olFolderInbox).Folders(botMailFolder)

i = 1

For Each OutlookMail In Folder.Items
    If InStr(OutlookMail.Subject, " ") <> 0 Then

        If OutlookMail.Attachments.Count > 0 Then

            Dim folderBase As String
            folderBase = botLocalFolder

            Dim newFolder As String
            newFolder = folderBase & OutlookMail.EntryID

            'OutlookItem.SenderAddress

            If Not FolderExists(newFolder) Then
                FolderCreate newFolder
            End If

            For Each a In OutlookMail.Attachments
                Dim newFileName As String
                newFileName = newFolder & "\" & a.DisplayName
                'MsgBox newFileName
                a.SaveAsFile newFileName
            Next

        End If

    End If

Next OutlookMail

问题是SenderSenderEmailAddressSenderName为空.仅SenderEmailType填充为 EX .

The problem is, Sender,SenderEmailAddress and SenderName are empty. Only SenderEmailType is populated as EX.

该代码作为Excel宏执行,我的所有发件人(用户)都是Exchange 2013用户.

The code is executed as an Excel macro and all my senders (users) are Exchange 2013 users.

如何找到电子邮件项目发件人的电子邮件地址和名称?

How can I find email address and name for the sender of an email item?

这是我在本地人窗口中看到的内容.

Here is what I see on my locals window.

框中的所有电子邮件都会发生这种情况.有人告诉我,这是因为所有人都是交换用户",企业管理员可以为他们设置限制.

This happens for all emails in the box. Someone told me it is because all are "exchange users" and for them enterprise admins can put restrictions.

推荐答案

我也遇到了这个问题.我唯一可以克服的方法是在OUTLOOK VBA中运行代码(Outlook->开发人员选项卡-> vba),而不是将应用程序专门作为Outlook应用程序启动.

I had this issue as well. The only way I could get past it is by running the code IN OUTLOOK VBA (Outlook -> developer tab -> vba), and do not start your application specifically as an outlook application.

示例:

Dim olApp As Outlook.Application
Set olApp = CreateObject(Outlook.Application)

需要成为

Dim olApp As Application
Set olApp = Application

诀窍是不要从外部Outlook(在Excel中为IE)打开Outlook的新实例.如果您具有任何类型的Outlook Exchange安全设置,则从excel中打开Outlook将禁止您访问关键信息,例如发件人.

The trick is to NOT open a new instance of outlook from outside outlook (IE. in Excel). If you've got any type of Outlook Exchange security settings, opening outlook from excel will prohibit you from accessing key pieces of information such as sender.

这篇关于Folder.Items中缺少发件人,SenderEmailAddress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆