Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
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,

> 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.

Same question like in April, I see. Your code still lacks to read any
property after calling Advise.
Does your Advise work when you remove the POP3 account?
Is that POP3 account your only account or an additional account
besides an Exchange account?

I have notification code working which I can point to any folder.
I have Outlook 2007 in cached mode, pointed my code to the "Sent
items" and get notifications as mails are sent.

Another difference besides reading any property after calling Advise
is that I open the folder I want to monitor as IMAPIFolder and call
GetContentsTable to get an IMAPITable where I set some basic
columns like PR_ENTRYID, PR_SUBJECT...
That table is what I use to call Advise on, followed by GetProps call.

You could try if that works better than IMsgStore->Advise

> The problem occurs when I have both outlook 2003 and outlook 2007
> clients in the same domain.

That should really make no difference

--
SvenC
date: Fri, 4 Jul 2008 08:23:36 +0200   author:   SvenC am

Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007   
> Is that POP3 account your only account or an additional account
> besides an Exchange account?
Yes, it is an additional account other than my Exchange account. 
> Does your Advise work when you remove the POP3 account?
The problem is with outlook cached mode.
My server settings.
1 x Exchange 2003 & 1 x Exchange 2007 (Same domain)
+Office 2007
Cached mode with additional mailbox : Outbound mails are not getting notified.

Could you please send me your code snippet, so that I can verify where I am 
going wrong.


"SvenC" wrote:

> Hi kavitha,
> 
> > 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.
> 
> Same question like in April, I see. Your code still lacks to read any
> property after calling Advise.
> Does your Advise work when you remove the POP3 account?
> Is that POP3 account your only account or an additional account
> besides an Exchange account?
> 
> I have notification code working which I can point to any folder.
> I have Outlook 2007 in cached mode, pointed my code to the "Sent
> items" and get notifications as mails are sent.
> 
> Another difference besides reading any property after calling Advise
> is that I open the folder I want to monitor as IMAPIFolder and call
> GetContentsTable to get an IMAPITable where I set some basic
> columns like PR_ENTRYID, PR_SUBJECT...
> That table is what I use to call Advise on, followed by GetProps call.
> 
> You could try if that works better than IMsgStore->Advise
> 
> > The problem occurs when I have both outlook 2003 and outlook 2007
> > clients in the same domain.
> 
> That should really make no difference
> 
> --
> SvenC
>
date: Thu, 3 Jul 2008 23:38: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

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?
          I have the IMAPITable and IMAPIFolder as my class variables.

> Which folder exactly are you working with?
          Im working with my Sent Items Folder.
date: Tue, 30 Sep 2008 01:11:01 -0700   author:   Rashmi

Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007   
Hi Dmitry,
Im using Exchange 2007 and Outlook 2007.
Is there any way to see the fnevTableModified event for my Sent Items folder 
in Outlook 2007 using OutlookSpy.
date: Tue, 7 Oct 2008 04:33:00 -0700   author:   Rashmi

Re: Unable to receive IMAPIAdviseSink:: OnNotify in outlook 2007   
I thought  you can see it just fine in OutlookSpy when you click IMAPIFolder 
button and go to the GetContentsTable tab?

-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Rashmi"  wrote in message 
news:8B7305D2-8C48-4DC0-A688-B7E50AF58B2D@microsoft.com...
> Hi Dmitry,
> Im using Exchange 2007 and Outlook 2007.
> Is there any way to see the fnevTableModified event for my Sent Items 
> folder
> in Outlook 2007 using OutlookSpy.
>
>
date: Tue, 7 Oct 2008 09:43:09 -0700   author:   Dmitry Streblechenko

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us