Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Fetching Outlook Categories: ATL / COM add-in (http://www.outlookbanter.com/add-ins-outlook/70836-fetching-outlook-categories-atl-com.html)

Rod Fitzsimmons Frey April 23rd 08 06:11 PM

Fetching Outlook Categories: ATL / COM add-in
 
I'm trying to fetch the categories exposed by the Outlook Namespace. I'm
executing this code:

CComPtrOutlook::_NameSpace pSession;
m_Application-get_Session(&pSession);
Outlook::_Categories * pCategories = NULL;
pSession-get_Categories(&pCategories);

which is raising an exception : Access violation writing location 0x3005ce28.

I'm doing this during the OnConnection message of the Application. pSession
seems to be valid.

Any pointers? Clearly I'm making some bonehead mistake.

Thanks!
Rod

Ken Slovak - [MVP - Outlook] April 24th 08 02:38 PM

Fetching Outlook Categories: ATL / COM add-in
 
I can't help with C++/ATL code, but does it work if you wait until the
OnStartupComplete event fires? What about a timer that fires to execute that
code some time after OnStartupComplete fires?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rod Fitzsimmons Frey" Rod Fitzsimmons
wrote in message ...
I'm trying to fetch the categories exposed by the Outlook Namespace. I'm
executing this code:

CComPtrOutlook::_NameSpace pSession;
m_Application-get_Session(&pSession);
Outlook::_Categories * pCategories = NULL;
pSession-get_Categories(&pCategories);

which is raising an exception : Access violation writing location
0x3005ce28.

I'm doing this during the OnConnection message of the Application.
pSession
seems to be valid.

Any pointers? Clearly I'm making some bonehead mistake.

Thanks!
Rod



Jeff[_7_] May 1st 08 05:43 PM

Fetching Outlook Categories: ATL / COM add-in
 
My code, ( in OL 2007 ) which works:

Outlook::_NameSpacePtr NS;
if(NS = spApp-GetNamespace(L"MAPI")){
_CategoriesPtr spCats = NS-Categories;

is essentually the same as yours. ( ignoring the smartpointers )
It's executed in the OnConnection event.


"Rod Fitzsimmons Frey" Rod Fitzsimmons
wrote in message ...
I'm trying to fetch the categories exposed by the Outlook Namespace. I'm
executing this code:

CComPtrOutlook::_NameSpace pSession;
m_Application-get_Session(&pSession);
Outlook::_Categories * pCategories = NULL;
pSession-get_Categories(&pCategories);

which is raising an exception : Access violation writing location
0x3005ce28.

I'm doing this during the OnConnection message of the Application.
pSession
seems to be valid.

Any pointers? Clearly I'm making some bonehead mistake.

Thanks!
Rod





All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com