Obtaining MAPI session from Outlook addin

Obtaining MAPI session from Outlook addin

Post by Andrej Bratk » Wed, 19 Feb 2003 17:51:47



Hi!

I have just begun developing an Outlook add-in in C++. As it turns out, the
OOM itself is somewhat limited in comparison to MAPI.

I know it is possible to obtain MAPI interfaces from OOM objects.
Specifically I am looking for  IMAPISession and IMsgStore (for each store in
the current profile). Could anyone point me in the right direction
(preferably some sample code - in C++ would be best, but VB would do as
well).

Thanks in advance, Andrej

 
 
 

Obtaining MAPI session from Outlook addin

Post by Dmitry Streblechenk » Thu, 20 Feb 2003 01:10:10


In Outlook 2002 you can use Namespace.MAPIOBJECT which evaluates to
IMAPISession. In Outlook 2000 calling MAPILogonEx() (and praying that you
are picking up the right session) is the only thing you can do.
IMsgStore objects are not directly accessible from OOM.
Since you are using C++, why not write an Exchange Client Extension?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool



Quote:> Hi!

> I have just begun developing an Outlook add-in in C++. As it turns out,
the
> OOM itself is somewhat limited in comparison to MAPI.

> I know it is possible to obtain MAPI interfaces from OOM objects.
> Specifically I am looking for  IMAPISession and IMsgStore (for each store
in
> the current profile). Could anyone point me in the right direction
> (preferably some sample code - in C++ would be best, but VB would do as
> well).

> Thanks in advance, Andrej


 
 
 

Obtaining MAPI session from Outlook addin

Post by Anton Chr. Lauridse » Thu, 20 Feb 2003 03:48:08


Hi

A word of warning: the knownledgebase article
http://support.microsoft.com/default.aspx?scid=kb;en-us;296483 warns about
the dangers of this way.

I have not been able to determine the exact SP combinations that trigger
this, but occasionally this will happen.

Anton Chr. Lauridsen
Opportunity Solutions A/S
www.oppsol.com



Quote:> Hi!

> I have just begun developing an Outlook add-in in C++. As it turns out,
the
> OOM itself is somewhat limited in comparison to MAPI.

> I know it is possible to obtain MAPI interfaces from OOM objects.
> Specifically I am looking for  IMAPISession and IMsgStore (for each store
in
> the current profile). Could anyone point me in the right direction
> (preferably some sample code - in C++ would be best, but VB would do as
> well).

> Thanks in advance, Andrej

 
 
 

Obtaining MAPI session from Outlook addin

Post by Andrej Bratk » Sat, 22 Feb 2003 23:14:11


Hi, Dmitry!

Thanks for the advice. I've looked into client extensions and all the
samples I found seem to work like a charm (for now). In my oppinoin, they
are even easier to implement (from a C++ perspective). I don't know why I
always thought Exchange client extensions only 'extend' the Exchange MAPI
provider (whatever that is - MSEMS probably). I suppose the name is a bit
misleading. So I've scraped my initial ideas of writing a COM add-in.

Regards, Andrej


> In Outlook 2002 you can use Namespace.MAPIOBJECT which evaluates to
> IMAPISession. In Outlook 2000 calling MAPILogonEx() (and praying that you
> are picking up the right session) is the only thing you can do.
> IMsgStore objects are not directly accessible from OOM.
> Since you are using C++, why not write an Exchange Client Extension?

> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool



> > Hi!

> > I have just begun developing an Outlook add-in in C++. As it turns out,
> the
> > OOM itself is somewhat limited in comparison to MAPI.

> > I know it is possible to obtain MAPI interfaces from OOM objects.
> > Specifically I am looking for  IMAPISession and IMsgStore (for each
store
> in
> > the current profile). Could anyone point me in the right direction
> > (preferably some sample code - in C++ would be best, but VB would do as
> > well).

> > Thanks in advance, Andrej

 
 
 

1. Problems with using MAPI.Session (Outlook 2002)

Hi,

I am trying to create a filter in VB that will insert
the headers into the e-mail body. But I can't seem to get
access to MAPI.Session.

Supposedly
        Set mySession = Application.GetNamespace("MAPI")
should work, and seems to do so.

But I can't get to folder, but needs MAPIFolder instead.
And can only get MailItems instead of Messages.

And a MailItem has no Headers property.

Can anybody help me here ?

2. How can i say for wich Usergroup Local Policies affect and wich not

3. 'Set x = New Mapi.Session' fails unless Session control loaded

4. Cannot save as

5. simple mapi/ outlook express/ outlook problem

6. Book of interest to programmers.

7. MAPI - Outlook Express/Outlook Conflict.

8. WTT: PCI Powermac for Amiga

9. Adding an Outlook COM-Addin (VisualBasic)

10. Is there a counterpart of IExchExtAttachedFileEvents in Outlook COM AddIn

11. Accessing IPersistMessage from an Outlook addin

12. Save As Addin in Outlook

13. VB Outlook Addin - Create NameSpace within Folder List