Article View: borland.public.cppbuilder.nativeapi
Article #15987OutlookApplication and MAPI questions.
From: Peter Elbertse
Date: Tue, 03 Jun 2003 15:32
Date: Tue, 03 Jun 2003 15:32
41 lines
2663 bytes
2663 bytes
Hello all,
Today I've been trying to understand the TOutlookApplication. I want to open (if not allready
opened) a single instance of Outlook and display the Calendar.
Which the code below I managed to open it, but every time I execute the code it openes up a new
Outlook window... I just want to reuse the existing one... Any help is appreciated.
This code works, but generates new instances of the Outlook window:
//--------------------------
// Try to connect to outlook (using the existing instance if active):
OutlookApplication->Connect();
// Open the MAPI Object and display the Calendar:
NameSpacePtr nSpace = OutlookApplication->GetNamespace( WideString("MAPI") );
MAPIFolderPtr mCalendar = nSpace->GetDefaultFolder(olFolderCalendar);
mCalendar->Display();
//--------------------------
Now this code connects too, but errors on the Explorer assignment..
I don't even know if this code would solve the multi-instances, but I thought it was worth to try:
//--------------------------
// Try to connect to outlook (using the existing instance if active):
OutlookApplication->Connect();
// Open the MAPI Object and display the Calendar:
NameSpacePtr nSpace = OutlookApplication->GetNamespace( WideString("MAPI") );
MAPIFolder *mapiCalendar = nSpace->GetDefaultFolder(olFolderCalendar);
Explorers *expCalendar = OutlookApplication->Explorers;
Explorer *exprCalendar = expCalendar->Add( CComVariant(&mapiCalendar),
olFolderDisplayNoNavigation);
exprCalendar->Display();
//--------------------------
Best Regards,
Peter Elbertse
Technical Details
Message-ID:
<3edcbf89$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,bb6a2675dacd778c,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-03 08:41:11 PST From: "Peter Elbertse" <zoetjuh@wanadoo.nl> Newsgroups: borland.public.cppbuilder.nativeapi Subject: OutlookApplication and MAPI questions. Date: Tue, 3 Jun 2003 17:32:25 +0200 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 212.238.183.121 Message-ID: <3edcbf89$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054654345 212.238.183.121 (3 Jun 2003 08:32:25 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail