使用EWS API无法将Exchange帐户的电子邮件白名单[SOAP请求]

时间:2018-11-19 12:59:27

标签: java soap exchangewebservices

  

我们已经在JAVA中开发了一个应用,该应用将垃圾邮件列入了白名单   Exchange Office 365帐户中的电子邮件文件夹。它在/正在正常工作   一个邮箱,我们也收到了适当的回复。但这不是   在生产邮箱中工作,之前工作正常。

工作邮箱SOAP响应:

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1339" MinorBuildNumber="26" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></s:Header><s:Body><m:MarkAsJunkResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><m:ResponseMessages><m:MarkAsJunkResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode></m:MarkAsJunkResponseMessage></m:ResponseMessages></m:MarkAsJunkResponse></s:Body></s:Envelope>

问题邮箱SOAP响应:

{
   "__type":"MarkAsJunkJsonRequest:#Exchange",
   "Header":{
      "__type":"JsonRequestHeaders:#Exchange",
      "RequestServerVersion":"Exchange2013",
      "TimeZoneContext":{
         "__type":"TimeZoneContext:#Exchange",
         "TimeZoneDefinition":{
            "__type":"TimeZoneDefinitionType:#Exchange",
            "Id":"West Asia Standard Time"
         }
      }
   },
   "Body":{
      "__type":"MarkAsJunkRequest:#Exchange",
      "ItemIds":[
         {
            "__type":"ItemId:#Exchange",
            "Id":"AAMkADk0ZTZmYzk0LWI1NTYtNDhiMi1hNWY1LTVkNjEwYjI5MGJjOQBGAAAAAABJb9uPcu8zT6LnpCUq3LWvBwC46WWBQWmKS69lWTrD0xv/AAABhxDBAAC46WWBQWmKS69lWTrD0xv/AAFjP1QMAAA=",
            "ChangeKey":"CQAAABYAAAC46WWBQWmKS69lWTrD0xv/AAFlA1rA"
         }
      ],
      "IsJunk":false,
      "MoveItem":true,
      "SendCopy":false,
      "JunkMessageHeader":"Outlook junk mail report",
      "JunkMessageBody":"This message was automatically generated by the Junk Mail Reporting Tool in Outlook. The attachment and information below will help Microsoft to improve the quality of its junk mail filters in the future."
   }
}
  

它只是说“成功”,但它并没有移到“收件箱”文件夹中。

     

请帮助我理解并寻求积极的解决方案。

     

注意:此代码段中的changekey已缩短以保留   可读性

新发现 我无法使用提琴手来跟踪请求/响应。它仅显示网络流量详细信息,可能是我做错了。我只是在chrome浏览器中玩过,发现了以下内容。 当我选择“不是垃圾邮件”并选择“不报告” 时,它将显示以下内容

{
   "__type":"ReportMessageToSafetyLibraryRequest:#Exchange",
   "ItemIds":[
      {
         "__type":"ItemId:#Exchange",
         "ChangeKey":"CQAAABYAAAC46WWBQWmKS69lWTrD0xv/AAFlA1Ks",
         "Id":"AAMkADk0ZTZmYzk0LWI1NTYtNDhiMi1hNWY1LTVkNjEwYjI5MGJjOQBGAAAAAABJb9uPcu8zT6LnpCUq3LWvBwC46WWBQWmKS69lWTrD0xv/AAABhxDBAAC46WWBQWmKS69lWTrD0xv/AAFjP1QLAAA="
      }
   ],
   "ReportAction":2,
   "ActionData":null
}

注意:尝试通过发送“ SendCopy”:true来实现

当我选择“不是垃圾邮件”并选择“报告” 时,它将显示以下 ReportMessageToSafetyLibraryRequest

clear-host
$content = Get-Content D:\Temp.txt | Out-String
$content = $content -split "/><"

$FirstN = [regex]::match($content[2],'Answer="([^/)]+)" Type=').Groups[1].Value
$LastN  = [regex]::match($content[3],'Answer="([^/)]+)" Type=').Groups[1].Value
$Title  = [regex]::match($content[4],'Answer="([^/)]+)" Type=').Groups[1].Value
$Dep    = [regex]::match($content[5],'Answer="([^/)]+)" Type=').Groups[1].Value
$Div    = [regex]::match($content[6],'Answer="([^/)]+)" Type=').Groups[1].Value
$Mobile = [regex]::match($content[7],'Answer="([^/)]+)" Type=').Groups[1].Value
$Phone  = [regex]::match($content[8],'Answer="([^/)]+)" Type=').Groups[1].Value
$Manager= [regex]::match($content[9],'DisplayName=&quot;([^/)]+)&quot; Id=&quot;').Groups[1].Value

$properties =@{
'First Name' =$FirstN
'Last Name'  =$LastN 
'Title'      =$Title 
'Department' =$Dep   
'Division'   =$Div   
'Mobile'     =$Mobile
'IP Phone'   =$Phone 
'Manager'    =$Manager
}

我认为我们没有处理SOAP请求中的 ReportMessageToSafetyLibrary 的选项。

0 个答案:

没有答案