Microsoft graph api 要与图形通信的Outlook邮件ID?

Microsoft graph api 要与图形通信的Outlook邮件ID?,microsoft-graph-api,outlook-addin,Microsoft Graph Api,Outlook Addin,我有一个Outlook加载项mailitem,我需要它来查找ID,以便我可以使用它与Microsoft Graph进行通信 mailitem EntryID与Microsoft Graph邮件ID不同 我唯一能想到的办法是,像这样获取公关信息: Public Shared Function GetInternetMessageID(ByRef mail As MailItem) As String Try Dim s As String = mail.PropertyAc

我有一个Outlook加载项mailitem,我需要它来查找ID,以便我可以使用它与Microsoft Graph进行通信

mailitem EntryID与Microsoft Graph邮件ID不同

我唯一能想到的办法是,像这样获取公关信息:

Public Shared Function GetInternetMessageID(ByRef mail As MailItem) As String
    Try
        Dim s As String = mail.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001F").ToString.ToLower.Replace(vbCrLf, " ").Replace("  ", "").Replace("message-id:<", "message-id: <")
        Return "<" + s.GetInnerString("message-id: <", ">") + ">"
    Catch ex As System.Exception
        Return String.Empty
    End Try
End Function
https://graph.microsoft.com/v1.0/me/messages?$filter=internetMessageId eq '<HE1AR0301DD2555F3F27E45C4E1100@HE1PR1301MB2255.eurprd03.prod.outlook.com>'
公共共享函数GetInternetMessageID(ByRef mail作为MailItem)作为字符串
尝试

Dim s As String=mail.PropertyAccessor.GetProperty(“http://schemas.microsoft.com/mapi/proptag/0x007D001F“.ToString.ToLower.Replace(vbCrLf)”.Replace(“,”).Replace(“消息id:我找到的唯一方法是使用ConvertId EWS操作将MAPI条目id转换为EWS id,然后将“+”替换为“\u”并将“/”替换为”-“

您应该能够使用TranslateExchangeID图形服务在entryId和restId之间进行转换

这篇文章可能会有帮助


据我所知,微软将在不久的将来关闭EWS,以支持Graph。我希望Outlook团队和Graph团队开始合作……唉。不完全是这样——我的经验法则是Outlook自己做什么。目前它只使用EWS(当然除了MAPI之外).当他们从EWS切换到Graph时,我将升级我的代码。
#Graph uses URL-safe encoding, work around it
$sourceID = ("AAAAAEI4ipo6z2ZLl269wbCQeHMHACD+gIoVTa5CpTqvk1wNXAAAAAAAAQwAACD+gIoVTa5CpTqvk1wNXAAAAq2DE+kAAA==" -replace "\+","-") -replace "/","_"
$countToReplace = ($sourceID.ToCharArray() | ? {$_ -eq "="}).Count
$sourceID = $sourceID.TrimEnd("=") + $countToReplace
 
$body = @{
"inputIds"= @($sourceID)
"sourceIdType"= "entryId"
"targetIdType"= "ewsId"
} | ConvertTo-Json
$res = Invoke-RestMethod -Method Post -Uri "https://graph.microsoft.com/v1.0/users/sharednew@Michev.info/translateExchangeIds" -Headers $authHeader -Verbose -ContentType "application/json" -Body $body
$res.value.targetId
 
$body = @{
"inputIds"= @($sourceID)
"sourceIdType"= "entryId"
"targetIdType"= "immutableEntryId"
} | ConvertTo-Json
$res = Invoke-RestMethod -Method Post -Uri "https://graph.microsoft.com/v1.0/users/sharednew@Michev.info/translateExchangeIds" -Headers $authHeader -Verbose -ContentType "application/json" -Body $body
$res.value.targetId
 
AAMkADQxMTViNmEzLWViNWYtNGYxNy1iNmQ2LTZmNDVhN2Q5ZDI0NQBGAAAAAABCOIqaOs9mS5duvcGwkHhzBwAg/oCKFU2uQqU6r5NcDVwAAAAAAAEMAAAg/oCKFU2uQqU6r5NcDVwAAAKtgxPpAAA=
 
AAAAAB2EAxGqZhHNm8gAqgAvxFoNACD-gIoVTa5CpTqvk1wNXAAAAq2DORgAAA2