I have some code that scans through the e-mail inbox to gather the subject lines to compare them with a logging solution, and this had been working well for some time using the MAPI integration. I've been trying to upgrade it to use the NS App handler, and it mostly works, but I'm having a problem as it is scanning through the inbox. When it gets to certain messages in the inbox, which typically has over 100 items in it, it stops and throws up the famous:
This message is for C/AL programmers:
This Automation variable has not been instantiated.
You can instantiate it by either creating or assigning it.
What is odd is that it is collecting this data with no problem for over 80 of the items, and it is stopping at a particular e-mail. However, this e-mail changes all the time, as the inbox is constantly being updated with new items, so the problem doesn't lie within the e-mail subject. The following is the simple code that generates this error every single time:
Name DataType Subtype Length
OInbox Automation 'NS Outlook Synchronization Handler'.OInboxItems
OInboxItem Automation 'NS Outlook Synchronization Handler'.OInboxItem
OApp Automation 'NS Outlook Synchronization Handler'.OApplication
CLEAR(OApp);
CREATE(OApp);
OApp.Logon;
OInbox := OApp.OInboxItems;
OInboxItem := OInbox.Item(85);
MESSAGE(OInboxItem.Subject);
I'm running Nav 4.0 SP3 SQL and Outlook 2003.
Comments
When the routine tries to access the subject lines of those messages it is tripping up on, these messages are NDR reports, and Outlook/Exchange treat these differently from other messages. So it looks as the NS App Handler only deals with bonafide messages, and not these pseudo-messages.
Anyone have a workaround to suggest?