NS.GetSharedDefaultFolder 方法的运行时错误

发布于 2024-12-17 07:57:15 字数 901 浏览 0 评论 0原文

通过 Outlook Interop 库从 MS Access (2007) 运行它。我在一个用户帐户的加星号行中收到错误 -2147221219 (8004011d),但在另一个用户帐户上却没有。错误似乎与权限有关,并且两个帐户都对我尝试打开其日历的帐户具有完全访问权限,并且可以通过 Outlook 打开并创建约会。示例代码

Public Function NewApt(MtgDate As Date, Cat As String)

Dim objOLApp As Outlook.Application
Dim objNS As Outlook.Namespace
Dim objCalendar As Outlook.Folder
Dim NewMtg As Outlook.AppointmentItem
Dim Org As Outlook.Recipient

Set objOLApp = New Outlook.Application
Set objNS = objOLApp.GetNamespace("MAPI")
Set Org = objNS.CreateRecipient("[email protected]")
Org.Resolve
If Org.Resolved Then
    ** Set objCalendar = objNS.GetSharedDefaultFolder(Org, olFolderCalendar)
Else
    MsgBox "Scheduling User failed to resolve, see Crimius."
    Exit Function
End If
...

有什么想法吗?

Running it from MS Access (2007) via the Outlook Interop library. I get the error -2147221219 (8004011d) from the starred line on one user account, but not on another. Error appears to be related to permissions, and both accounts have Full Access permissions to the account who's calendar I'm trying to open and can open and create appointments to it via Outlook. Sample code

Public Function NewApt(MtgDate As Date, Cat As String)

Dim objOLApp As Outlook.Application
Dim objNS As Outlook.Namespace
Dim objCalendar As Outlook.Folder
Dim NewMtg As Outlook.AppointmentItem
Dim Org As Outlook.Recipient

Set objOLApp = New Outlook.Application
Set objNS = objOLApp.GetNamespace("MAPI")
Set Org = objNS.CreateRecipient("[email protected]")
Org.Resolve
If Org.Resolved Then
    ** Set objCalendar = objNS.GetSharedDefaultFolder(Org, olFolderCalendar)
Else
    MsgBox "Scheduling User failed to resolve, see Crimius."
    Exit Function
End If
...

Any ideas why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

走野 2024-12-24 07:57:15

我知道可能出现此错误的原因之一。
当您使用 GetSharedDefaultFolder 方法并且参数 1 中的收件人(收件人)在全局地址列表中隐藏时,可能会发生以下错误:

COMException (0x8004011D):
The operation failed because of a registry or installation problem. Restart Outlook and try again. If the problem persists, reinstall.

I know one reason why this error may appear.
Whe you use the GetSharedDefaultFolder method and the recipient in parameter 1 (Recipient) is hidden from the global address list such an error can occur:

COMException (0x8004011D):
The operation failed because of a registry or installation problem. Restart Outlook and try again. If the problem persists, reinstall.
寂寞美少年 2024-12-24 07:57:15

也许 Outlook 数据文件受密码保护。
切换到 Outlook,输入 Outlook 容器的密码,然后重试。

Maybe, the Outlook-Datafile is protected by password.
Switch to Outlook, enter the Password for the Outlook-Container, and then try again.

梦里寻她 2024-12-24 07:57:15

我有完全相同的问题。运行多年的 VBA 模块突然拒绝了。经过验证,内部电子邮件地址已更改为之前运行的宏...

更改为电子邮件地址解决了问题。

I had exactly the same issue. A VBA module that ran during years suddenly refused to. After verification it turned out that the internal e-mail addresses changed to previous runs of the macro...

Changing to email addresses solved the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文