I have an .xls file containing a large amount of emails, which i want to add to outlook via matlab. Processing the .xls file is no problem.
I found it is possible to send mails via matlab using
h = actxserver('outlook.Application'
and i figured i might be able to use this for my purpose. I'm however completely unfamiliar with the ActiveX/COM interface, and how to use it.
I tried to use get(h) but that did not give me any useful information.
Two questions. Specifically 1) how can i use Matlab to add contacts.
And secondly, more general, how would i be able to find out what i can do with 'h' in this case? I see people using h.Subject
or h.To
How would i be able to find out the possible things (like Subject or To) i can do with h?
To add a contact you need to create a ContactItem
object through the ActiveX control:
h = actxserver('outlook.Application');
newContact = h.CreateItem('olContactItem');
newContact.FirstName = 'John';
newContact.LastName = 'Smith';
newContact.Email1Address = '[email protected]';
newContact.Save();
% newContact.Display; % To check your work
h.release; % Close the ActiveX interface
See the ContactItem
properties page for a list of other fields you can modify.
For the general question, it just takes some poking around in Outlook's Object Model Reference