A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Why DispEventAdvise couldn't work?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 10th 09, 03:20 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default Why DispEventAdvise couldn't work?

Q1: In OnConnection function, the follow code can work. I'm using outlook2003.

Outlook::MAPIFolderPtr pSentFd = m_NSPtr-GetDefaultFolder(Outlook::
olFolderSentMail);
pSentFdItems = pSentFd-GetItems();
ItemsItemAddEvent:ispEventAdvise(pSentFdItems);
But following couldn't, why?
m_NSPtr-GetFolders(); then loop to search the specified folder, i'm sure i
found the correct folder, then
if(HotPtr != NULL)//HotPtr is the correct MAPIFolderPtr for olFolderSentMail.
{
CComPtrOutlook::_Items HotInboxItems = HotPtr-GetItems();
long ll = HotInboxItems-GetCount();
ItemsItemAddEvent:ispEventAdvise(HotInboxItems);
}
But the event could not be fired.
Q2: How could i get MailItem of the mail receive from HTTP hotmail? I don't
know how to DispEventAdvise on hotmail's message store(I add a HTTP account
which is MS's hotmail), i use the code above to set event on the folder of
hotmail(and i'm sure the folder is correct folder), but couldn't work. Is
there a way to get hotmail's(INTERSTOR) "Namespace" so that i can get its
folder to set the current advise?
In a word, i want to get the MailItem of HTTP mail from hotmail to process,
is that clear?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1

Ads
  #2  
Old April 10th 09, 07:52 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Why DispEventAdvise couldn't work?

1. The object raising the events (HotInboxItems) must be alive at all times.
Make sit a global/cklass variable rather than a local one.
2. There is nothing special about the Hotmail store (which is really a PST
store).

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:945fd1e51fdd8@uwe...
Q1: In OnConnection function, the follow code can work. I'm using
outlook2003.

Outlook::MAPIFolderPtr pSentFd = m_NSPtr-GetDefaultFolder(Outlook::
olFolderSentMail);
pSentFdItems = pSentFd-GetItems();
ItemsItemAddEvent:ispEventAdvise(pSentFdItems);
But following couldn't, why?
m_NSPtr-GetFolders(); then loop to search the specified folder, i'm sure
i
found the correct folder, then
if(HotPtr != NULL)//HotPtr is the correct MAPIFolderPtr for
olFolderSentMail.
{
CComPtrOutlook::_Items HotInboxItems = HotPtr-GetItems();
long ll = HotInboxItems-GetCount();
ItemsItemAddEvent:ispEventAdvise(HotInboxItems);
}
But the event could not be fired.
Q2: How could i get MailItem of the mail receive from HTTP hotmail? I
don't
know how to DispEventAdvise on hotmail's message store(I add a HTTP
account
which is MS's hotmail), i use the code above to set event on the folder of
hotmail(and i'm sure the folder is correct folder), but couldn't work. Is
there a way to get hotmail's(INTERSTOR) "Namespace" so that i can get its
folder to set the current advise?
In a word, i want to get the MailItem of HTTP mail from hotmail to
process,
is that clear?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1



  #3  
Old April 10th 09, 10:23 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default Why DispEventAdvise couldn't work?

Yes, that's right, i change the object to a member of class, it is ok. Thanks
in advance. ^_^
But here is another question, in my test code, i assume that the MsgStore's
name is "hotmail", but in fact the name can be not "hotmail". What's the
better way to get the correct entry id of inbox?(not default MsgStore).

Dmitry Streblechenko wrote:
1. The object raising the events (HotInboxItems) must be alive at all times.
Make sit a global/cklass variable rather than a local one.
2. There is nothing special about the Hotmail store (which is really a PST
store).


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1

  #4  
Old April 12th 09, 09:18 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Why DispEventAdvise couldn't work?

2. I don't think there is anything you can do if you are using the Outlook
Object Model alone.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:94638267fd003@uwe...
Yes, that's right, i change the object to a member of class, it is ok.
Thanks
in advance. ^_^
But here is another question, in my test code, i assume that the
MsgStore's
name is "hotmail", but in fact the name can be not "hotmail". What's the
better way to get the correct entry id of inbox?(not default MsgStore).

Dmitry Streblechenko wrote:
1. The object raising the events (HotInboxItems) must be alive at all
times.
Make sit a global/cklass variable rather than a local one.
2. There is nothing special about the Hotmail store (which is really a PST
store).


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1



  #5  
Old April 14th 09, 10:17 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default Why DispEventAdvise couldn't work?

Hi, Dmitry, thank you for your reply.
I am now try to use MAPI for this problem, and have a small question.
Assume the default profile name's "MyProfile". These are what i did:
1.IProfAdmin::AdminServices to get ServiceAdmin
2.IMsgServiceAdmin::GetMsgServiceTable to get table
3.IMAPITable::QueryRows to get all message store rows.
4.for loop to find property of PR_SERVICE_NAME_A use PpropFindProp.
If find check if it is "INTERSTOR", if it is "INTERSTOR", check the ""
propery, but the second check is failed, can you help me out with it?
This is the code snippet:
for(ULONG uLoop = 0; uLoop pStoreRows-cRows; uLoop ++)
{
lpCurProp = pStoreRows-aRow[uLoop].lpProps;
uCurValue = pStoreRows-aRow[uLoop].cValues;
lpRetStoreProp = PpropFindProp( lpCurProp, uCurValue, PR_SERVICE_NAME_A )
;
if (_CheckStringProp(lpRetStoreProp, PT_STRING8))
{
// compare the string with "INTERSTOR"
CString szServiceName(lpRetStoreProp-Value.lpszA);
if(!szServiceName.CompareNoCase("INTERSTOR"))
{
lpCurProp = pStoreRows-aRow[uLoop].lpProps;
uCurValue = pStoreRows-aRow[uLoop].cValues;
// get the message provider UID
lpRetStoreProp = PpropFindProp( lpCurProp, uCurValue,
PR_PROVIDER_UID );
if(lpRetStoreProp && PR_PROVIDER_UID == lpRetStoreProp-ulPropTag)

{// Here failed, what's going on?
}
}
}
}
I'm sure that PR_PROVIDER_UID is the exist property.
Thanks in advance.

Dmitry Streblechenko wrote:
2. I don't think there is anything you can do if you are using the Outlook
Object Model alone.

Yes, that's right, i change the object to a member of class, it is ok.
Thanks

[quoted text clipped - 9 lines]
2. There is nothing special about the Hotmail store (which is really a PST
store).


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1

  #6  
Old April 14th 09, 03:56 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Why DispEventAdvise couldn't work?

Why exactly does the check fail?
What do you see in OutlookSpy when you click IMAPISession::AdminServices

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:9495c05312ffe@uwe...
Hi, Dmitry, thank you for your reply.
I am now try to use MAPI for this problem, and have a small question.
Assume the default profile name's "MyProfile". These are what i did:
1.IProfAdmin::AdminServices to get ServiceAdmin
2.IMsgServiceAdmin::GetMsgServiceTable to get table
3.IMAPITable::QueryRows to get all message store rows.
4.for loop to find property of PR_SERVICE_NAME_A use PpropFindProp.
If find check if it is "INTERSTOR", if it is "INTERSTOR", check the ""
propery, but the second check is failed, can you help me out with it?
This is the code snippet:
for(ULONG uLoop = 0; uLoop pStoreRows-cRows; uLoop ++)
{
lpCurProp = pStoreRows-aRow[uLoop].lpProps;
uCurValue = pStoreRows-aRow[uLoop].cValues;
lpRetStoreProp = PpropFindProp( lpCurProp, uCurValue,
PR_SERVICE_NAME_A )
;
if (_CheckStringProp(lpRetStoreProp, PT_STRING8))
{
// compare the string with "INTERSTOR"
CString szServiceName(lpRetStoreProp-Value.lpszA);
if(!szServiceName.CompareNoCase("INTERSTOR"))
{
lpCurProp = pStoreRows-aRow[uLoop].lpProps;
uCurValue = pStoreRows-aRow[uLoop].cValues;
// get the message provider UID
lpRetStoreProp = PpropFindProp( lpCurProp, uCurValue,
PR_PROVIDER_UID );
if(lpRetStoreProp && PR_PROVIDER_UID ==
lpRetStoreProp-ulPropTag)

{// Here failed, what's going on?
}
}
}
}
I'm sure that PR_PROVIDER_UID is the exist property.
Thanks in advance.

Dmitry Streblechenko wrote:
2. I don't think there is anything you can do if you are using the Outlook
Object Model alone.

Yes, that's right, i change the object to a member of class, it is ok.
Thanks

[quoted text clipped - 9 lines]
2. There is nothing special about the Hotmail store (which is really a
PST
store).


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200904/1



  #7  
Old April 15th 09, 07:25 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default Why DispEventAdvise couldn't work?

I solved it, After check the terms with outlookspy, my mind's clear and then
the problem were sloved, thank again, Dmitry.

Dmitry Streblechenko wrote:
Why exactly does the check fail?
What do you see in OutlookSpy when you click IMAPISession::AdminServices

Hi, Dmitry, thank you for your reply.
I am now try to use MAPI for this problem, and have a small question.

[quoted text clipped - 44 lines]
PST
store).


--
Message posted via http://www.officekb.com

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Greek Fonts Dont work in Office but work in Windows George Outlook - Using Contacts 0 May 16th 07 10:33 PM
How to set up 3 days at work 3 days off work repeating? Glenn Tricarico Outlook - Calandaring 2 February 12th 07 11:57 PM
How do I customize my work week if I work different hours daily? Pratherer Outlook - Calandaring 1 October 31st 06 05:57 AM
e-mail alerts don't work,setup but don't work- Studmn1 Outlook - General Queries 3 August 24th 06 09:38 PM
Getting no Events ! - IDispEventSimpleImpl , DispEventAdvise davidb Add-ins for Outlook 3 June 13th 06 08:31 AM


All times are GMT +1. The time now is 09:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.