Giter Site home page Giter Site logo

Send attachments about ews-javascript-api HOT 3 CLOSED

gautamsi avatar gautamsi commented on May 19, 2024
Send attachments

from ews-javascript-api.

Comments (3)

gautamsi avatar gautamsi commented on May 19, 2024

Attachments are not available yet.
I can spend some time in next few days to add Attachment features, stay tuned.

from ews-javascript-api.

gautamsi avatar gautamsi commented on May 19, 2024

getting there, able to create Attachment and send it, loading items with InternetHeaders are an issue. next checkin should have GetAttachment and InternetHeaders reading fixed.

from ews-javascript-api.

gautamsi avatar gautamsi commented on May 19, 2024

you should now be able to send attachment. fetch 0.2.0 version from npm.
#13 contains attachment updates.

completed:
send attachment with EmailMessage
ExchangeService.GetAttachments to load attachment from server.

pending:
CreateAttachment (explicit request) - EmailMessage can be sent with attachment.
DeleteAttachment - delete attachment on server.

example send message with attachment. (File attachment is added as base64 content rather than file name or stream/buffer)

var exch = new ExchangeService(ExchangeVersion.Exchange2013);
exch.Credentials = new ExchangeCredentials(credentials.userName, credentials.password);
exch.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx");
EwsLogging.DebugLogEnabled = true; // false to turnoff debugging. 

var msgattach = new EmailMessage(exch);
msgattach.Subject = "Dentist Appointment";
msgattach.Body = new MessageBody("The appointment is with Dr. Smith.");
msgattach.ToRecipients.Add("[email protected]")
var file = msgattach.Attachments.AddFileAttachment("filename to attach.txt", "c29tZSB0ZXh0");
/** AddFileAttachment parameters - 
 * filename (name of attachment as shown in outlook/owa not actual file from disk), 
 * base64 content of file (read file from disk and convert to base64 yourself)
 */
msgattach.Send().then(() => {
    console.log("------------");
}, (ei) => {
    console.log(ei.stack, ei.stack.split("\n"));
    console.log("------------");
});

from ews-javascript-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.