You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在PowerShell中添加Exchange Online共享邮箱时遇RDOSession.MAPIObject接口不支持异常

解决Outlook+Redemption PowerShell中“Interface not supported”错误(添加Exchange共享邮箱场景)

问题重现

尝试通过PowerShell结合Outlook COM对象与Redemption为当前用户添加Exchange Online共享邮箱时,执行$session.MAPIOBJECT = $outlook.Session.MAPIOBJECT抛出以下错误:

Interface not supported
At line:15 char:1
+ $session.MAPIOBJECT = $outlook.Session.MAPIOBJECT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

使用的代码:

# Create Outlook application object
$outlook = New-Object -ComObject Outlook.Application
$session = New-Object -ComObject Redemption.RDOSession

# Get the MAPI namespace
$namespace = $outlook.GetNamespace("MAPI")
$namespace.Logon()
#$inbox = $namespace.GetDefaultFolder(6)

$recipientName = "xxx@yyy.com";
$Recipient = $namespace.CreateRecipient($recipientName);
$Recipient.Resolve();

$session.MAPIOBJECT = $outlook.Session.MAPIOBJECT

系统环境

  • 操作系统:Windows 11 23H2
  • Outlook版本:Microsoft® Outlook® 2019 MSO (Version 2312 Build 16.0.17126.20132) 32-bit
  • Redemption版本:6.4.0.6234 32/64Bit
  • 已尝试应用Outlook 2013 C2R修复包,无改善

解决方案

1. 强制匹配PowerShell与Outlook的位数

Outlook为32位,必须使用32位PowerShell运行脚本(64位PowerShell无法兼容32位COM对象,会直接导致接口不支持错误)。

  • 打开方式:开始菜单搜索Windows PowerShell (x86),以管理员身份运行后执行脚本。

2. 调整Redemption会话初始化逻辑

无需通过Outlook对象传递MAPIOBJECT,直接使用Redemption自身的登录方法绑定当前Outlook配置文件,再添加共享邮箱:

# 初始化Redemption会话
$session = New-Object -ComObject Redemption.RDOSession
# 使用当前Outlook配置文件登录(无需手动指定)
$session.Logon()

# 添加共享邮箱
$sharedMailbox = $session.Stores.AddSharedMailbox("xxx@yyy.com")
# 验证是否添加成功
Write-Host "共享邮箱已添加:$($sharedMailbox.Name)"

3. 重新注册Redemption组件

以管理员身份打开32位PowerShell,执行以下命令重新注册Redemption DLL(路径根据实际安装位置调整):

regsvr32.exe "C:\Program Files (x86)\Redemption\Redemption.dll"

4. 更新Redemption至最新版本

当前使用的6.4.0版本可能对Outlook 2019的兼容性不足,更新到最新版本后重试。

5. 替代方案:直接通过Outlook对象添加共享邮箱

如果Redemption仍有问题,可尝试直接使用Outlook COM对象添加共享邮箱(需确保用户有权限访问目标邮箱):

$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNamespace("MAPI")
$namespace.Logon()

$recipient = $namespace.CreateRecipient("xxx@yyy.com")
$recipient.Resolve()
if ($recipient.Resolved) {
    $sharedFolder = $namespace.GetSharedDefaultFolder($recipient, 6) # 6对应收件箱
    Write-Host "成功访问共享邮箱收件箱:$($sharedFolder.Name)"
    # 若需持久化添加到Outlook导航栏,可手动设置或使用Outlook的自动映射功能
}

内容的提问来源于stack exchange,提问作者Manfred P.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 23:35:29