Outlook Automation open Outlook Window

Betrachter84Betrachter84 Member Posts: 62
Hi there

I have the following problem:

I'm using Outlook Automation to implement some features into NAV 2009 Classic Client. One feature is a link from NAV to Outlook Inbox, Sent Objects, Drafts and so on...

My Problem is the following:
I want to have only one Outlook-Window open at all times. Meaning the Automation has to recognize the active Outlook-Window and switch the view to what i want, eg. Inbox. One Problem is that the Automation openes a new window each time it's called. Another problem is that if the Outlook Window eg. Inbox is closed manually, the Automation returns an error if it should open the Inbox-View again.

My Code looks like this:

Name DataType Subtype Lengtht
OutlookFolder Automation 'Microsoft Outlook 12.0 Object Library'.Folder
OutlookFolders Automation 'Microsoft Outlook 12.0 Object Library'.Folders
OutlookNamespace Automation 'Microsoft Outlook 12.0 Object Library'.NameSpace
OutlookApp Automation 'Microsoft Outlook 12.0 Object Library'.Application
OutlookInboxFolder Automation 'Microsoft Outlook 12.0 Object Library'.Folder


IF ISCLEAR(OutlookApp) THEN
CREATE(OutlookApp);

OutlookNamespace := OutlookApp.GetNamespace('MAPI');
OutlookNamespace.Logon('','',TRUE,FALSE);


OutlookFolders := OutlookNamespace.Folders;
NoOfFolders := OutlookFolders.Count;
OutlookFolder := OutlookFolders.GetFirst;

// here i'm looping through all the folders in Outlook in Order to find eg. Inbox.

OutlookInboxFolder := OutlookFolder;

OutlookInboxFolder.Display;

Does anyone have som code examples of handling Outlook Automation the described way? I have searched the forum for simmilar issues, but have'nt found anything...

Thanks alot!
Sign In or Register to comment.