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

如何将Get-MailboxFolderStatistics返回的storeId转为Graph API的restId?

将Exchange PowerShell的StoreID转换为Microsoft Graph的REST ID

关于translateExchangeIds端点的支持情况

该端点完全支持将Get-MailboxFolderStatistics返回的StoreID转换为Graph的REST ID,你之前转换失败大概率是参数格式或ID类型指定错误导致的。

正确使用translateExchangeIds的步骤

  1. 确认输入ID的正确性:从Get-MailboxFolderStatistics中提取的是FolderId属性值(纯十六进制长字符串,不要包含StoreId:前缀)。
  2. 指定正确的ID类型参数:
    • sourceIdType必须设为storeId
    • targetIdType可设为restId(常规REST ID)或restImmutableEntryId(不可变ID,推荐用于长期存储)
  3. 示例请求:
    POST https://graph.microsoft.com/v1.0/users/{userId}/translateExchangeIds
    Content-Type: application/json
    
    {
      "inputIds": ["AAEuAAAAAA..."],
      "sourceIdType": "storeId",
      "targetIdType": "restImmutableEntryId"
    }
    

转换失败的常见排查点

  • 验证userId是否为目标用户的邮箱地址或Azure AD对象ID
  • 确保请求账号拥有Mail.Read或更高权限
  • 检查输入的StoreID是否完整无截断

其他转换方法

  1. PowerShell内置转换:使用Exchange Online Management模块的Convert-ExchangeIdentity cmdlet直接转换:
    $folderStats = Get-MailboxFolderStatistics -Identity user@contoso.com -FolderScope Inbox
    $restId = Convert-ExchangeIdentity -Identity $folderStats.FolderId -SourceType StoreId -TargetType RestId
    
  2. EWS辅助转换:如果你的代码环境已集成EWS Managed API,可先通过EWS将StoreID转换为EntryID,再传入Graph的转换端点,但这种方式不如直接调用translateExchangeIds高效。

内容的提问来源于stack exchange,提问作者Susi_003

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.31 04:09:26