如何设置共享默认文件夹的Outlook子文件夹? [英] How to set Outlook sub-folders of a shared default folder?

查看:372
本文介绍了如何设置共享默认文件夹的Outlook子文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从共享的Outlook收件箱的子文件夹中提取信息.

I am trying to extract information from sub-folders of a shared Outlook inbox.

当我将文件夹设置为共享收件箱(olFolderInbox)时,代码可以正常工作,但是,当我将其设置为子文件夹时,代码有时会失败.我确保子文件夹名称正确.

When I set the folder to the shared inbox (olFolderInbox) the code works perfectly, however, when I set it to a sub-folder, the code will sometimes fail. I ensured that the sub-folder name was correct.

这是我的代码:

Dim OutlookNameSpace As Outlook.Namespace
Dim OutlookFolder As Outlook.Folder
Dim OutlookMail As Outlook.MailItem
Dim ObjOwner As Outlook.Recipient

Set OutlookNameSpace = Outlook.Application.GetNamespace("MAPI")
Set ObjOwner = OutlookNameSpace.CreateRecipient("EmailName@email.ca")
ObjOwner.Resolve

If ObjOwner.Resolved Then

  Set OutlookFolder = OutlookNameSpace.GetSharedDefaultFolder _ 
    (ObjOwner, olFolderInbox).Folders("FolderName")

End If

错误消息是:

"运行时错误'-2147221233(8004010f)":
尝试的操作失败.找不到对象."

"Run-time error '-2147221233 (8004010f)':
The attempted operation failed. An object could not be found."

调试工具会突出显示我尝试将子文件夹设置为Outlook文件夹的行.

The debugging tool highlights the line where I tried to set the sub-folder as the Outlook Folder.

当我注释掉时:.Folders("FolderName")宏运行正常.

When I comment out: .Folders("FolderName") the macro runs fine.

为什么这段代码有时会失败?

Why does this code sometimes fail?

推荐答案

请记住,如果缓存了委托默认文件夹(在主邮箱的OST文件中),则子文件夹将不存在.

Keep in mind that if the delegate default folders are cached (in the primary mailbox's OST file), the sub folders will not be present.

尝试关闭代理文件夹的缓存-取消选中"Exchange帐户属性"对话框高级"选项卡上的下载共享文件夹"复选框.

Try to turn caching off for the delegate folders - uncheck the "Download shared folders" checkbox on the Advanced tab of the Exchange account properties dialog.

这篇关于如何设置共享默认文件夹的Outlook子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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