07-19-2010 09:52 AM
Hello,
I've been doing some work to interface Microsoft Outlook and one of my LabVIEW applications. I'm currently able to create tasks, calendar items, and mail. I've also been able to figure out how to read my contacts list. Unfortunately, I can't seem to find the right combination of nodes to read my calendar or mail.
Can anybody point me in the right direction (ie the order of ActiveX classes/Invoke Nodes to use) to make this work? I know that it should be easy, I'm just not very familiar with ActiveX. I appreciate any help that you can provide. Thanks.
Bryan
Solved! Go to Solution.
07-19-2010 10:04 AM
This is really an Outlook object model question rather than a LabVIEW question, so you're better off hunting the internet for examples on how to use the Outlook object model to do this. Here's one link I found with Google.
07-19-2010 11:00 AM - edited 07-19-2010 11:01 AM
I looked at the example, and was able to follow along and read the number of messages in my mailbox. I can't seem to figure out how to actually parse the information out though. Have I done something wrong, or am I just missing the properties that I need to use?
I assume that I can do the mail and contacts in a similar way?
Thanks,
Bryan
07-19-2010 11:29 AM
One issue you have is that the folder type you specified is incorrect. It should be "olFolderInbox" to read your mail. Within the loop you have to get each item and then convert the variant to the appropriate Outlook object. See attached mod which reads out the subjects. It should put you on the right road. Don't forget to close all your references (including the collections that are created).
07-20-2010 09:19 AM
I was playing around with reading mail and the calendar and uploaded the file without changing both back. Looks like I just made a stupid error and had an invoke where I needed a property node. Your example took care of it. Thanks for the help.
12-19-2016 02:52 PM - edited 12-19-2016 02:53 PM
If you have recurring appointment items only the first one will be listed. Refere to this page on the subject.
Ben64
oups, replied to wrong post...
08-08-2017 04:20 AM
I tested your code with my outlook client, but it seems a little wrong.
There are 200+ mails in my INBOX(counted by your code '216'),but the string array just show 6 elements,and with the error code 3008
08-08-2017 04:35 AM
While ,if I change 'FileType' into sentfile ,it works fine.
08-09-2017 09:37 AM
It appears that some types of outlook emails do not allow you to obtain the subject in this way - it returns error 3008. I have found this to be the case with calendar invite emails, but there may also be other types.
So here is what is happening for you: At some point the code gets to an email that is a calendar invite or something else and can't get its subject. The error is propagated on the shift register so that the next loop iteration, when it tries to get the next item in the inbox, it already has an error in and so it doesn't even try and just propagates the error further (in LabVIEW, most functions are set up so they do nothing in the case of an error in). Thus, you are actually getting 216 elements in the string array, but just they are blank strings after the point at which the error occurred.
To fix this, right click on the shift register and click "Replace With Tunnels." Then the error won't propagate and you will only get empty strings for the calendar items (or whatever other items don't work with this). You could also filter out the empty ones if you want, with a conditional tunnel:
You may also want to handle the error in a better way.
01-14-2019 04:22 AM
prettypwnie I had this problem for some time and it was such a simple issue. Thank you for pointing this out.