How do I add an Appointment in Outlook from within MATLAB 7.2 (R2006a)?

8 views (last 30 days)
I would like to know how I can add an appointment to Microsoft Outlook from within MATLAB using ActiveX. I would also like to attach the appointment to email created from within MATLAB.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This example illustrates how to create and send an appointment in Outlook from within MATLAB using ActiveX:
h = actxserver('outlook.Application')
% Create the appointment object
appointment = h.CreateItem('olAppointmentItem')
% Set some common properties of the appointment object.
appointment.Subject = 'Myappointment'
appointment.Body = 'This appointment was created in MATLAB'
appointment.Location = 'myLocation'
appointment.Start = '04/26/2006'
appointment.End = '04/27/2006'
appointment.ReminderSet = 1
appointment.ReminderMinutesBeforeStart = 5
appointment.IsOnlineMeeting = 0
%Save the appointment
appointment.Save()
You can attach this appointment to an email and send it:
%Create email object
mail = h.CreateItem('olMail');
%Set properties of the email object
mail.Subject = 'This email was sent from within MATLAB';
mail.To = 'myemail@mathworks.com';
mail.Body = 'Please find your appointment attached';
mail.BodyFormat = 'olFormatHTML';
%Attach the appointment to the email
mail.attachments.Add(appointment);
%Send the email
mail.Send;
%Release the Outlook interface
h.release;%

More Answers (0)

Products


Release

R2006a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!