nmarus / node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API.
MIT License
116 stars 52 forks source link

How to save attachment #110

Closed sharma-akshay closed 5 years ago

sharma-akshay commented 5 years ago

I am using following code to get the attachment:

const ewsDownloadArgs = { 'AttachmentShape': 'IncludeMimeContent', 'AttachmentIds': { 't:AttachmentId': { 'attributes': { 'Id': attachId } } } };

and in am getting following response: { "ResponseMessages": { "GetAttachmentResponseMessage": { "attributes": { "ResponseClass": "Success" }, "ResponseCode": "NoError", "Attachments": { "FileAttachment": { "AttachmentId": { "attributes": { "Id": "AAMkADY3OGQ5MGFhLWNlYWQtNGJjMi05MTYwLTZjYTNlMzI2YWQ1OQBGAAAAAADRW5Kjev/UTpBRR7pAh/f9BwD6PXxU2joVQLLJLJOs0hVgAAAAHilNAACG2dle/gIBT6sIMrzTTPi+AAS60MjxAAABEgAQANbjP302I2ZNidJLbGhPZn8=" } }, "Name": "akshay.jpg", "ContentType": "image/jpeg", "Content": "/9j/4AAQSkZJRgABAAEAyADIAAD/z3BFySPpzSWZTX2H/4H/8AagsOls/w/wCCem/C39lbwz8K/E1r4l0zxDqN/NaxyottcWVvBG3mqRlpI5mPGc/d5rlrV3V6OPz/AOAjVQa0vp6W/U+qK5ywoAKACgAoA//Z" } } } } } I have shorten the content for ref only. How to save this file attachment using node js. I am trying to write the file using the value in "Content", but it shows file as corrupted