OfficeDev / ews-managed-api

Other
585 stars 322 forks source link

Fail to get eml item #151

Open joewutaiwan opened 6 years ago

joewutaiwan commented 6 years ago

Hi all,

When I request a eml at office 365 mail via EWS mgr API which has size bigger than 20MB

curl -X POST  -
v https://outlook.office365.com/EWS/Exchange.asmx  
-H 'authorization: Bearer [my token]'   
-H 'cache-control: no-cache'   
-H 'content-type: text/xml; charset=utf-8'  
-d '
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013"/>
    <t:ExchangeImpersonation>
      <t:ConnectingSID>
        <t:PrincipalName>joyceb@synologydst.onmicrosoft.com</t:PrincipalName>
      </t:ConnectingSID>
    </t:ExchangeImpersonation>
  </soap:Header>
  <soap:Body>
    <m:GetItem>
      <m:ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
        <t:IncludeMimeContent>true</t:IncludeMimeContent>
      </m:ItemShape>
      <m:ItemIds>
        <t:ItemId Id="AAMkADVmMzE2MjY0LTZkOGYtNGI4MS1iNWMxLTljYzg3MWY5MW
                QxMQBGAAAAAABZMfR36TVMQ6yunaqZPvVRBwAF9fKWjhbKTIB6d
                NkgJcvkAACMMEXVAAAF9fKWjhbKTIB6dNkgJcvkAACQktc5AAA="/>
      </m:ItemIds>
    </m:GetItem>
  </soap:Body>
</soap:Envelope>
' 
-o out

Sometimes it only returns part response, ends in middle of base64 encoded string in tag MimeContent

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  blahblah...
<m:Items>
<t:Message>
<t:MimeContent CharacterSet="UTF-8">UmVjZWl2ZWQ6IGZyb20gS0wxUFIwN _[EOF]_

And the response header: http status code 200

< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/10.0
< request-id: 0a8f0ddc-5bc2-450b-855a-ba5cd8366683
< X-CalculatedFETarget: SG2PR06CU005.internal.outlook.com
< X-BackEndHttpStatus: 200
< Set-Cookie: exchangecookie=7192fbb48c474609a0ae62646b483b84; 
    expires=Wed, 06-Feb-2019 10:10:44 GMT; path=/; HttpOnly
< X-FEProxyInfo: SG2PR06CA0152.APCPRD06.PROD.OUTLOOK.COM
< X-CalculatedBETarget: SIXPR06MB0860.apcprd06.prod.outlook.com
< X-BackEndHttpStatus: 200
< x-ms-appId: 3445f9b9-57db-4b28-89bf-471dcc7c3de5
< x-EwsHandler: GetItem
< X-AspNet-Version: 4.0.30319
< X-DiagInfo: SIXPR06MB0860
< X-BEServer: SIXPR06MB0860
< X-FEServer: SG2PR06CA0152
< X-Powered-By: ASP.NET
< X-FEServer: HK2PR02CA0133
< Date: Tue, 06 Feb 2018 10:10:47 GMT

Want to know how to handle big size eml like this or some resume download method?

Thanks!

mowagieh commented 4 years ago

@joewutaiwan did you managed to find a fix for this?