Query Interface on a C++ addin

Discussion in 'Microsoft Outlook Program Addins' started by James Callahan, Jun 11, 2004.

  1. I have built a C++ COM Addin for Outlook. All of the
    reference material says I can access the Outllok Object
    Model for Contacts as follows:

    _ApplicationPtr pApp;
    _ItemsPtr pItems;
    MAPIFolderPtr pFolder;
    _ContactItemPtr pContact;
    hr=pApp.CreateInstance(__uuidof(Application));
    pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
    ->GetDefaultFolder(olFolderContacts);
    pItems = pFolder->GetItems();
    pContact = pItems->GetFirst();


    Unfortunately, I get an error when I try to compile which
    states that the GetNamespace does not take one parameter.
    How can get to the interfaces in the mso.dll? I am using
    the following import command:

    #import "C\<my location>\mso.dll"
    rename_namespace("Office"),named_guids
    using namespace Office;
    #import "C:\<my location>\MSOUTL.OLB"
    rename_namespace("Outlook"), raw_interfaces_only,
    named_guids
    using namespace Outlook;

    Thanks in advance,
    James
     
    James Callahan, Jun 11, 2004
    #1
    1. Advertisements

  2. Here is the list of imports that I use ...

    #import "D:\My Documents\SQLView\Outlook\mso.dll"
    #import "C:\Program Files\Common Files\Microsoft
    Shared\VBA\VBA6\vbe6ext.olb"
    #import "D:\My Documents\SQLView\Outlook\msoutl.olb"
    rename_namespace("Outlook")
    #import "C:\Windows\System32\stdole2.tlb" rename_namespace("Forms")
    #import "C:\Windows\System32\fm20.dll" exclude("OLE_COLOR", "OLE_HANDLE",
    "Font") rename_namespace("Forms")


    --
    Michael Tissington
    http://www.oaklodge.com
    http://www.tabtag.com


    "James Callahan" <> wrote in message
    news:1aff901c44f51$21273760$...
    > I have built a C++ COM Addin for Outlook. All of the
    > reference material says I can access the Outllok Object
    > Model for Contacts as follows:
    >
    > _ApplicationPtr pApp;
    > _ItemsPtr pItems;
    > MAPIFolderPtr pFolder;
    > _ContactItemPtr pContact;
    > hr=pApp.CreateInstance(__uuidof(Application));
    > pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
    > ->GetDefaultFolder(olFolderContacts);
    > pItems = pFolder->GetItems();
    > pContact = pItems->GetFirst();
    >
    >
    > Unfortunately, I get an error when I try to compile which
    > states that the GetNamespace does not take one parameter.
    > How can get to the interfaces in the mso.dll? I am using
    > the following import command:
    >
    > #import "C\<my location>\mso.dll"
    > rename_namespace("Office"),named_guids
    > using namespace Office;
    > #import "C:\<my location>\MSOUTL.OLB"
    > rename_namespace("Outlook"), raw_interfaces_only,
    > named_guids
    > using namespace Outlook;
    >
    > Thanks in advance,
    > James
     
    Michael Tissington, Jun 11, 2004
    #2
    1. Advertisements

  3. James Callahan

    Guest Guest

    Thanks for the list of imports but I am having some
    diffculty with the "raw_interfaces_only" part. By
    including that in the import statement, what am I
    excluding?
    Thanks
    James
    >-----Original Message-----
    >Here is the list of imports that I use ...
    >
    >#import "D:\My Documents\SQLView\Outlook\mso.dll"
    >#import "C:\Program Files\Common Files\Microsoft
    >Shared\VBA\VBA6\vbe6ext.olb"
    >#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
    >rename_namespace("Outlook")
    >#import "C:\Windows\System32\stdole2.tlb" rename_namespace

    ("Forms")
    >#import "C:\Windows\System32\fm20.dll" exclude

    ("OLE_COLOR", "OLE_HANDLE",
    >"Font") rename_namespace("Forms")
    >
    >
    >--
    >Michael Tissington
    >http://www.oaklodge.com
    >http://www.tabtag.com
    >
    >
    >"James Callahan" <> wrote in

    message
    >news:1aff901c44f51$21273760$...
    >> I have built a C++ COM Addin for Outlook. All of the
    >> reference material says I can access the Outllok Object
    >> Model for Contacts as follows:
    >>
    >> _ApplicationPtr pApp;
    >> _ItemsPtr pItems;
    >> MAPIFolderPtr pFolder;
    >> _ContactItemPtr pContact;
    >> hr=pApp.CreateInstance(__uuidof(Application));
    >> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
    >> ->GetDefaultFolder(olFolderContacts);
    >> pItems = pFolder->GetItems();
    >> pContact = pItems->GetFirst();
    >>
    >>
    >> Unfortunately, I get an error when I try to compile

    which
    >> states that the GetNamespace does not take one

    parameter.
    >> How can get to the interfaces in the mso.dll? I am

    using
    >> the following import command:
    >>
    >> #import "C\<my location>\mso.dll"
    >> rename_namespace("Office"),named_guids
    >> using namespace Office;
    >> #import "C:\<my location>\MSOUTL.OLB"
    >> rename_namespace("Outlook"), raw_interfaces_only,
    >> named_guids
    >> using namespace Outlook;
    >>
    >> Thanks in advance,
    >> James

    >
    >
    >.
    >
     
    Guest, Jun 14, 2004
    #3
  4. You should not use raw_interfaces_only.

    Why don't you take a look at the generated header files to see the
    difference.

    --
    Michael Tissington
    http://www.oaklodge.com
    http://www.tabtag.com


    <> wrote in message
    news:1c5a301c45252$49dc3260$...
    > Thanks for the list of imports but I am having some
    > diffculty with the "raw_interfaces_only" part. By
    > including that in the import statement, what am I
    > excluding?
    > Thanks
    > James
    > >-----Original Message-----
    > >Here is the list of imports that I use ...
    > >
    > >#import "D:\My Documents\SQLView\Outlook\mso.dll"
    > >#import "C:\Program Files\Common Files\Microsoft
    > >Shared\VBA\VBA6\vbe6ext.olb"
    > >#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
    > >rename_namespace("Outlook")
    > >#import "C:\Windows\System32\stdole2.tlb" rename_namespace

    > ("Forms")
    > >#import "C:\Windows\System32\fm20.dll" exclude

    > ("OLE_COLOR", "OLE_HANDLE",
    > >"Font") rename_namespace("Forms")
    > >
    > >
    > >--
    > >Michael Tissington
    > >http://www.oaklodge.com
    > >http://www.tabtag.com
    > >
    > >
    > >"James Callahan" <> wrote in

    > message
    > >news:1aff901c44f51$21273760$...
    > >> I have built a C++ COM Addin for Outlook. All of the
    > >> reference material says I can access the Outllok Object
    > >> Model for Contacts as follows:
    > >>
    > >> _ApplicationPtr pApp;
    > >> _ItemsPtr pItems;
    > >> MAPIFolderPtr pFolder;
    > >> _ContactItemPtr pContact;
    > >> hr=pApp.CreateInstance(__uuidof(Application));
    > >> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
    > >> ->GetDefaultFolder(olFolderContacts);
    > >> pItems = pFolder->GetItems();
    > >> pContact = pItems->GetFirst();
    > >>
    > >>
    > >> Unfortunately, I get an error when I try to compile

    > which
    > >> states that the GetNamespace does not take one

    > parameter.
    > >> How can get to the interfaces in the mso.dll? I am

    > using
    > >> the following import command:
    > >>
    > >> #import "C\<my location>\mso.dll"
    > >> rename_namespace("Office"),named_guids
    > >> using namespace Office;
    > >> #import "C:\<my location>\MSOUTL.OLB"
    > >> rename_namespace("Outlook"), raw_interfaces_only,
    > >> named_guids
    > >> using namespace Outlook;
    > >>
    > >> Thanks in advance,
    > >> James

    > >
    > >
    > >.
    > >
     
    Michael Tissington, Jun 14, 2004
    #4
  5. Thanks...I printed the entire header file as well as the generated library
    and see the difference. Only problem now is that if I remove the
    "raw_intefaces_only" part, I generate a host of new errors in boilerplate
    code from Amit Day's article on ALT/COM addins for Outlook. If I understand
    correctly, we can access Office/Outlook type libraries by 1) using the
    #import command, 2) including the generated midl files directly and 3) via
    MFC COM. I have examples of two of the three and will experiment around to
    see which works best. As it stands now, I am using the #import with the
    raw_interfaces and have managed to access the functions I wanted although
    not in the manner I expected. Is the "raw_intefaces_only" the reason that I
    am forced to code
    CComPtr <Outlook::_Namespace> bNamespace;
    HRESULT hr = pApp->GetNamespace(_b_str_t("MAPI"), &bNamespace);
    instead of
    bNamespace = pApp->GetNamespace(_bstr_t("MAPI"));

    I really appreaciate your taking the time with me. I am trying to expand my
    horizons and learn this ALT/COM code.
    James
    "Michael Tissington" <> wrote in message
    news:%...
    > You should not use raw_interfaces_only.
    >
    > Why don't you take a look at the generated header files to see the
    > difference.
    >
    > --
    > Michael Tissington
    > http://www.oaklodge.com
    > http://www.tabtag.com
    >
    >
    > <> wrote in message
    > news:1c5a301c45252$49dc3260$...
    > > Thanks for the list of imports but I am having some
    > > diffculty with the "raw_interfaces_only" part. By
    > > including that in the import statement, what am I
    > > excluding?
    > > Thanks
    > > James
    > > >-----Original Message-----
    > > >Here is the list of imports that I use ...
    > > >
    > > >#import "D:\My Documents\SQLView\Outlook\mso.dll"
    > > >#import "C:\Program Files\Common Files\Microsoft
    > > >Shared\VBA\VBA6\vbe6ext.olb"
    > > >#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
    > > >rename_namespace("Outlook")
    > > >#import "C:\Windows\System32\stdole2.tlb" rename_namespace

    > > ("Forms")
    > > >#import "C:\Windows\System32\fm20.dll" exclude

    > > ("OLE_COLOR", "OLE_HANDLE",
    > > >"Font") rename_namespace("Forms")
    > > >
    > > >
    > > >--
    > > >Michael Tissington
    > > >http://www.oaklodge.com
    > > >http://www.tabtag.com
    > > >
    > > >
    > > >"James Callahan" <> wrote in

    > > message
    > > >news:1aff901c44f51$21273760$...
    > > >> I have built a C++ COM Addin for Outlook. All of the
    > > >> reference material says I can access the Outllok Object
    > > >> Model for Contacts as follows:
    > > >>
    > > >> _ApplicationPtr pApp;
    > > >> _ItemsPtr pItems;
    > > >> MAPIFolderPtr pFolder;
    > > >> _ContactItemPtr pContact;
    > > >> hr=pApp.CreateInstance(__uuidof(Application));
    > > >> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
    > > >> ->GetDefaultFolder(olFolderContacts);
    > > >> pItems = pFolder->GetItems();
    > > >> pContact = pItems->GetFirst();
    > > >>
    > > >>
    > > >> Unfortunately, I get an error when I try to compile

    > > which
    > > >> states that the GetNamespace does not take one

    > > parameter.
    > > >> How can get to the interfaces in the mso.dll? I am

    > > using
    > > >> the following import command:
    > > >>
    > > >> #import "C\<my location>\mso.dll"
    > > >> rename_namespace("Office"),named_guids
    > > >> using namespace Office;
    > > >> #import "C:\<my location>\MSOUTL.OLB"
    > > >> rename_namespace("Outlook"), raw_interfaces_only,
    > > >> named_guids
    > > >> using namespace Outlook;
    > > >>
    > > >> Thanks in advance,
    > > >> James
    > > >
    > > >
    > > >.
    > > >

    >
    >
     
    James Callahan, Jun 20, 2004
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Teresa

    Using Stamps.com Addin in Office XP SBE (Outlook 2002)

    Teresa, Jul 6, 2003, in forum: Microsoft Outlook Program Addins
    Replies:
    0
    Views:
    597
    Teresa
    Jul 6, 2003
  2. G Robertson

    "Not a valid Office addin" error message

    G Robertson, Jul 8, 2003, in forum: Microsoft Outlook Program Addins
    Replies:
    1
    Views:
    10,428
    Randy Byrne [MVP - Outlook]
    Jul 10, 2003
  3. Prashant

    Installing an Addin

    Prashant, Jul 9, 2003, in forum: Microsoft Outlook Program Addins
    Replies:
    0
    Views:
    686
    Prashant
    Jul 9, 2003
  4. TC
    Replies:
    0
    Views:
    393
  5. TC

    Outlook Addin Interferes with Outlook COM Addin Functionality

    TC, Dec 9, 2004, in forum: Microsoft Outlook Program Addins
    Replies:
    0
    Views:
    249
Loading...

Share This Page