|
|
|
date: Thu, 3 Jul 2008 21:11:00 -0700,
group: microsoft.public.platformsdk.mapi
back
Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
I am not able to get notifications for IMAPIAdviseSink:: OnNotify method when
a mail is sent from a outlook 2007 profile having cached mode/ POP 3 account
enabled.
The problem occurs when I have both outlook 2003 and outlook 2007 clients in
the same domain. I have my outlook profile in 2007 and by default it is in
cached mode. I should get a notification onto my application whenver i send
or receive mails from my outlook.
I am using IMAPIAdviseSink:: OnNotify to get the notifications. Since the
profile is in cached mode, I am not receiving any sort of notifications for
out bound mails.
I am setting Advise() for receiving the notification for both inbound and
outbound mails for a particular mail box( i.e. for both inbox and sent items
when a mail arrives)
/* for inbox*/
hr = HrMAPIFindInbox( m_lpMDB, &ulbeid, &lpeidInbox );
if ( SUCCEEDED( hr ) )
{
hr = m_lpMDB->Advise( ulbeid, ( LPENTRYID )lpeidInbox,
fnevObjectCreated|fnevCriticalError|fnevExtended, ( IMAPIAdviseSink * )this,
&m_ulInboxConnection );
}
/*For sent items folder*/
try
{
hr = HrGetOneProp( m_lpMDB, PR_IPM_SENTMAIL_ENTRYID, &pProp );
if ( SUCCEEDED( hr ) )
{
hr = m_lpMDB->Advise( pProp->Value.bin.cb, ( LPENTRYID
)pProp->Value.bin.lpb, fnevObjectCreated|fnevCriticalError|fnevExtended, (
IMAPIAdviseSink * )this, &m_ulOutboxConnection );
}
CLog::Log( _T( "EXITING CMAILBOXMONITOR SETSENTFOLDER" ) );
return hr;
}
Please do let me know as to why I am facing this problem and what is the
workaround for the same.Thanks in advance
date: Thu, 3 Jul 2008 21:11:00 -0700
author: kavitha
Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
Hi kavitha,
> Could you please send me your code snippet, so that I can verify
> where I am going wrong.
I removed all error checking and only left an indent instead:
hr = pSession->OpenMsgStore(0, cbMdbID, lpMdbID, NULL,
MDB_NO_DIALOG|MDB_WRITE, &spMdb);
CComPtr<IMAPIFolder> spFld;
hr = HrMAPIOpenFolderEx(spMdb, cFolderSep, pszFolderName, &spFld);
CComPtr<IMAPITable> spTbl;
hr = spFld->GetContentsTable(0, &spTbl);
hr = spTbl->SetColumns((LPSPropTagArray)&S_ADVISE_TAGS, 0);
hr = spTbl->Advise(fnevTableModified, pSink, pCookie);
hr = spTbl->GetProps((LPSPropTagArray)&S_ADVISE_TAGS, 0,
&nProps, &pProps);
My prop tags are:
static SizedSPropTagArray(S_ADVISE_NUMTAGS, S_ADVISE_TAGS) = {
S_ADVISE_NUMTAGS, { PR_ENTRYID, PR_STORE_ENTRYID, PR_SUBJECT,
PR_LONGTERM_ENTRYID_FROM_TABLE, PR_DISPLAY_NAME, PR_OBJECT_TYPE,
PR_PARENT_ENTRYID, PR_INSTANCE_KEY} };
--
SvenC
date: Fri, 4 Jul 2008 09:03:26 +0200
author: SvenC am
Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
Hi SvenC,
Im using Outlook 2007 and I want to capture my outgoing mails. Using
OutlookSpy I understood that for the outgoing mails, fnevObjectModified event
is fired.
I tried to call Advise() for my MessageStore and was able to capture the
fnevObjectModified event. But Im not able to get the exact message object
that is being sent.
Based on yr below code, I tried calling Advise for my sent items thro a
IMAPIFolder object. But I'm not receiving any notifications.
Can you guide me as to how to proceed exactly.
"SvenC" wrote:
> Hi kavitha,
>
> > Could you please send me your code snippet, so that I can verify
> > where I am going wrong.
>
> I removed all error checking and only left an indent instead:
>
> hr = pSession->OpenMsgStore(0, cbMdbID, lpMdbID, NULL,
> MDB_NO_DIALOG|MDB_WRITE, &spMdb);
> CComPtr<IMAPIFolder> spFld;
> hr = HrMAPIOpenFolderEx(spMdb, cFolderSep, pszFolderName, &spFld);
> CComPtr<IMAPITable> spTbl;
> hr = spFld->GetContentsTable(0, &spTbl);
> hr = spTbl->SetColumns((LPSPropTagArray)&S_ADVISE_TAGS, 0);
> hr = spTbl->Advise(fnevTableModified, pSink, pCookie);
> hr = spTbl->GetProps((LPSPropTagArray)&S_ADVISE_TAGS, 0,
> &nProps, &pProps);
>
> My prop tags are:
> static SizedSPropTagArray(S_ADVISE_NUMTAGS, S_ADVISE_TAGS) = {
> S_ADVISE_NUMTAGS, { PR_ENTRYID, PR_STORE_ENTRYID, PR_SUBJECT,
> PR_LONGTERM_ENTRYID_FROM_TABLE, PR_DISPLAY_NAME, PR_OBJECT_TYPE,
> PR_PARENT_ENTRYID, PR_INSTANCE_KEY} };
>
> --
> SvenC
>
>
date: Mon, 29 Sep 2008 01:54:09 -0700
author: Rashmi
Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
What are the relevant snippets of your code?
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Rashmi" wrote in message
news:4A012AB9-F9B8-4D42-8294-F4EEB8510272@microsoft.com...
> Hi SvenC,
>
> Im using Outlook 2007 and I want to capture my outgoing mails. Using
> OutlookSpy I understood that for the outgoing mails, fnevObjectModified
> event
> is fired.
> I tried to call Advise() for my MessageStore and was able to capture the
> fnevObjectModified event. But Im not able to get the exact message object
> that is being sent.
> Based on yr below code, I tried calling Advise for my sent items thro a
> IMAPIFolder object. But I'm not receiving any notifications.
>
> Can you guide me as to how to proceed exactly.
>
> "SvenC" wrote:
>
>> Hi kavitha,
>>
>> > Could you please send me your code snippet, so that I can verify
>> > where I am going wrong.
>>
>> I removed all error checking and only left an indent instead:
>>
>> hr = pSession->OpenMsgStore(0, cbMdbID, lpMdbID, NULL,
>> MDB_NO_DIALOG|MDB_WRITE, &spMdb);
>> CComPtr<IMAPIFolder> spFld;
>> hr = HrMAPIOpenFolderEx(spMdb, cFolderSep, pszFolderName, &spFld);
>> CComPtr<IMAPITable> spTbl;
>> hr = spFld->GetContentsTable(0, &spTbl);
>> hr = spTbl->SetColumns((LPSPropTagArray)&S_ADVISE_TAGS, 0);
>> hr = spTbl->Advise(fnevTableModified, pSink, pCookie);
>> hr = spTbl->GetProps((LPSPropTagArray)&S_ADVISE_TAGS, 0,
>> &nProps, &pProps);
>>
>> My prop tags are:
>> static SizedSPropTagArray(S_ADVISE_NUMTAGS, S_ADVISE_TAGS) = {
>> S_ADVISE_NUMTAGS, { PR_ENTRYID, PR_STORE_ENTRYID, PR_SUBJECT,
>> PR_LONGTERM_ENTRYID_FROM_TABLE, PR_DISPLAY_NAME, PR_OBJECT_TYPE,
>> PR_PARENT_ENTRYID, PR_INSTANCE_KEY} };
>>
>> --
>> SvenC
>>
>>
date: Mon, 29 Sep 2008 11:44:47 -0700
author: Dmitry Streblechenko
Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
Hi Dmitry,
Have a look at my code pasted below:
I have tried two methods for calling the Advise to my sent Items.
1. This is the code where I have set the event source for fnevObjectModified
and Im able to capture this event in my OnNotify(). Since Im getting the
IMAPIFolder object from the notification, Im not able to get the outgoing
message exactly.
hr = HrMAPIFindFolderEx(lpMdb, cFolderSep, pszFolderName, &ulbeid,
&lpeidOutbox);
if ( SUCCEEDED( hr ) )
{
hr = lpMDB->Advise( ulbeid, ( LPENTRYID )lpeidOutbox,
fnevObjectModified, ( IMAPIAdviseSink * )this, &ulOutboxConnection );
}
2. In this part of the code, I'm getting the contents table of the sent
items and calling the Advise for my IMAPITable object. But the notification
is not fired when I execute this code.
hRes = pAddrBook->OpenEntry((ULONG)cbeid,(LPENTRYID)lpeid, NULL,
MAPI_BEST_ACCESS, &ulObjType, (LPUNKNOWN*)&lpGAL);
hRes = lpGAL->GetContentsTable( 0L, &lpContentsTable);
hRes = HrQueryAllRows( lpContentsTable, (SPropTagArray*)&sptCols, NULL,
NULL, 0, &pRows);
hRes = HrMailboxLogon(m_pMapiSession, m_pInfoStore, pszMailBoxDN,
pRows->aRow[0].lpProps[0].Value.lpszA, &pUserMDB );
hRes = HrMAPIOpenFolderEx(pUserMdb, cFolderSep, pszFolderName, &lpFld);
hRes = lpFld->GetContentsTable(0, &lpTbl);
hRes = lpTbl->SetColumns((LPSPropTagArray)&propTags, 0);
hRes = lpTbl->Advise(fnevTableModified, ( IMAPIAdviseSink * )this,
&ulOutboxConnection);
hRes = lpTbl->GetProps((LPSPropTagArray)&propTags, 0, &nProps, &pProps);
"Dmitry Streblechenko" wrote:
> What are the relevant snippets of your code?
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
>
date: Mon, 29 Sep 2008 23:30:01 -0700
author: Rashmi
Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007
Do you keep IMAPITable and IMAPIFolder as in global/class variables to make
sure they arae referenced when your code is running?
Which folder exactly are you working with?
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Rashmi" wrote in message
news:C363193E-8D6C-48F1-853C-6AC546F8796F@microsoft.com...
> Hi Dmitry,
>
> Have a look at my code pasted below:
> I have tried two methods for calling the Advise to my sent Items.
>
> 1. This is the code where I have set the event source for
> fnevObjectModified
> and Im able to capture this event in my OnNotify(). Since Im getting the
> IMAPIFolder object from the notification, Im not able to get the outgoing
> message exactly.
> hr = HrMAPIFindFolderEx(lpMdb, cFolderSep, pszFolderName, &ulbeid,
> &lpeidOutbox);
>
> if ( SUCCEEDED( hr ) )
> {
> hr = lpMDB->Advise( ulbeid, ( LPENTRYID )lpeidOutbox,
> fnevObjectModified, ( IMAPIAdviseSink * )this, &ulOutboxConnection );
> }
>
>
> 2. In this part of the code, I'm getting the contents table of the sent
> items and calling the Advise for my IMAPITable object. But the
> notification
> is not fired when I execute this code.
>
> hRes = pAddrBook->OpenEntry((ULONG)cbeid,(LPENTRYID)lpeid, NULL,
> MAPI_BEST_ACCESS, &ulObjType, (LPUNKNOWN*)&lpGAL);
>
> hRes = lpGAL->GetContentsTable( 0L, &lpContentsTable);
> hRes = HrQueryAllRows( lpContentsTable, (SPropTagArray*)&sptCols, NULL,
> NULL, 0, &pRows);
>
> hRes = HrMailboxLogon(m_pMapiSession, m_pInfoStore, pszMailBoxDN,
> pRows->aRow[0].lpProps[0].Value.lpszA, &pUserMDB );
> hRes = HrMAPIOpenFolderEx(pUserMdb, cFolderSep, pszFolderName, &lpFld);
> hRes = lpFld->GetContentsTable(0, &lpTbl);
> hRes = lpTbl->SetColumns((LPSPropTagArray)&propTags, 0);
> hRes = lpTbl->Advise(fnevTableModified, ( IMAPIAdviseSink * )this,
> &ulOutboxConnection);
> hRes = lpTbl->GetProps((LPSPropTagArray)&propTags, 0, &nProps, &pProps);
>
>
> "Dmitry Streblechenko" wrote:
>
>> What are the relevant snippets of your code?
>>
>> --
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>> -
>>
date: Mon, 29 Sep 2008 23:42:10 -0700
author: Dmitry Streblechenko
|
|