View Single Post
  #1  
Old May 6th 06, 08:53 AM posted to microsoft.public.outlook.program_addins
seby
external usenet poster
 
Posts: 1
Default Problem getting Incoming Item in my Outlook Addin

It seems there is a bug in an addin i am working on. While retrieving an incoming MailItem from outlook using this code:

Outlook::_MailItemPtr spMItem;
hr = spItems-raw_GetLast(&pDisp);
spMItem = pDisp;

the spMItem is always NULL , even though this is fired in Check New Mail event

Q1: Shouldn't GetLast be the last added item aka new Email ?
Q2: Since the same happens with OnAddItem, OnItemChanged ...

OnItemChangedParameter ( IDispatch iDisp)
{ // cast to _MailItemPtr
spMItem = iDisp; // spMItem is NULL on incoming email

how can one get the New item (incoming message) using this type of code (ATL/C++) in a spMItem
Just looking for a simple reliable solution
Thank you
~SB

Ads