Fetching Outlook Categories: ATL / COM add-in

  • Thread starter Rod Fitzsimmons Frey
  • Start date
R

Rod Fitzsimmons Frey

I'm trying to fetch the categories exposed by the Outlook Namespace. I'm
executing this code:

CComPtr<Outlook::_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
 
K

Ken Slovak - [MVP - Outlook]

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?
 
J

Jeff

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top