LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Read Outlook Calendar and Task List

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(7,077 Views)

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.

Message 2 of 10
(7,071 Views)

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

0 Kudos
Message 3 of 10
(7,064 Views)

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).

Message 4 of 10
(7,056 Views)
Solution
Accepted by topic author bguy638

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.

0 Kudos
Message 5 of 10
(7,044 Views)

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...

0 Kudos
Message 6 of 10
(5,108 Views)

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 errorinMAIL.png

0 Kudos
Message 7 of 10
(4,944 Views)

While ,if I change 'FileType' into sentfile ,it works fine.

sentBOX.png

0 Kudos
Message 8 of 10
(4,943 Views)

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:error tunnels.png

 

 

You may also want to handle the error in a better way.

Message 9 of 10
(4,924 Views)

prettypwnie   I had this problem for some time and it was such a simple issue. Thank you for pointing this out.

0 Kudos
Message 10 of 10
(3,936 Views)