Re:ExtendedMAPI newbie: using Extended MAPI from within an Outlook COM-Addin
1. If your code is running in the main Outlook thread, you don't need to
call MAPIInitialize(). If you create your own thread, you do need to call it
if you are using MAPI on that thread.
2. If you are running Outlook 2000 or below, you need to call MAPILogonEx()
to retrieve IMAPISession specifying that you do not want a new session. Note
however that some extensions/addins instantiate a new MAPI session different
from the one used by Outlook, so you could retrieve that session instead. In
Outlook 2002 and up, you can use Namespace.MAPIOBJECT which evaluates to
IMAPISession. Other than that, you can write an Exchange Client Extension
instead (see IExchExtXXX interfaces on MSDN) - works in all versions of
Outlook. This way you will be able to retrieve the session directly from
Outlook.
3. If you already have the store entry id, all you need to do is call
IMAPISession.OpenMsgStore(), no search required.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Quote
"Oliver Giesen" <ogw...@gmx.net> wrote in message
news:3ef7109e$1@newsgroups.borland.com...
Quote
> First off: are there any Delphi examples on Extended MAPI out there that I
> wouldn't have to pay 50$ for?
> I've already filled my toolbox with:
> - Redemption Objects
> - Extended MAPI header translations from Dmitry Streblechenko
> - Dmitry's Babelfish and Paul Quall's sample add-ins
> - Outlook Spy
> I was already getting along fine using the regular Outlook object model or
> its Redemption counterparts where necessary but now I've obviously come to
> the point where I won't get any further without using Extended MAPI (also
> see my earlier post).
> I frankly do not even know where to start.
> Do I have to use the MAPIInitialize and MAPILogon functions from a COM
> Add-in? Am I not already in a logged in context? If so, where can I get my
> IMAPISession reference?
> The particular problem I'm facing right now is that I need to determine
the
> user name corresponding to the mailbox of the currently selected folder. I
> figured that I would use the StoreID of the currently selected folder (as
> could be read from the Outlook object model) to somehow get a IMsgStore
> pointer to the mailbox and then read the PR_MAILBOX_OWNER_NAME property.
> As I said, my problem is how to get going. Is there a way to query for the
> IMsgStore by its StoreID at all or would I have to traverse the entries
> returned by IMAPISession.GetMsgStorestable to search for a match myself?
> Help? Pointers?
> Cheers,
> Oliver
> ---- ------------------
> JID: ogie...@jabber.org
> ICQ: 18777742
> (http://wwp.icq.com/18777742)