How to find all accounts used in Outlook?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,
I have developed an addin for outlook.
I want to give an alert message for all incoming messages.
I have finished for default mail account.
How can i set for other Accounts? Also how to find all accounts used in outlook?
Pls help me.
Thanks
 
An ItemAdd handler for the Inbox's Items collection would handle all emails
delivered to your Inbox no matter which email account it was sent to. You
don't really need multiple handlers for that.

The list of all email accounts for a specific Outlook profile is stored in
the registry. Much of the information there is binary and not documented.
 
Hi ken,
Thanks for ur reply.
I wrote ItemAdd event. But it fire for default account only.
It doesn't fire other accounts when incoming mails added to other account's inbox's.
My code is:
CComPtr<_NameSpace> spNameSpace;
m_spApp->GetNamespace(bstr,&spNameSpace);
CComPtr<Outlook::MAPIFolder> spMAPIFolder;
spNameSpace->GetDefaultFolder(olFolderInbox,&spMAPIFolder);
spMAPIFolder->get_Items(&m_spItems);

hr = ItsEvents1::DispEventAdvise((IDispatch*)m_spItems[1],&__uuidof(ItemsEvents));

I map the ItemAdd function as :

SINK_ENTRY_INFO(1,__uuidof(ItemsEvents), 0xf001, OnItemAdd, &ParInfoD)

How can i solve it?
Pls reply me.
Thanks.
 
It's not that difficult to search the registry for Outlook accounts - but be
aware that they are stored in different places for different versions of
Outlook.

The easiest way to find out where they are stored is to dump HKCU before and
after adding a new account and diff the resulting files - you may need to
convert the file format from Unicode for some diff tools (e.g. WinMerge),
but you can do this with a half-decent text editor (e.g. metapad).

HTH
Matt Fletcher

ComputerGanesh said:
Hi ken,
Thanks for ur reply.
I wrote ItemAdd event. But it fire for default account only.
It doesn't fire other accounts when incoming mails added to other account's inbox's.
My code is:
CComPtr<_NameSpace> spNameSpace;
m_spApp->GetNamespace(bstr,&spNameSpace);
CComPtr<Outlook::MAPIFolder> spMAPIFolder;
spNameSpace->GetDefaultFolder(olFolderInbox,&spMAPIFolder);
spMAPIFolder->get_Items(&m_spItems);

hr = ItsEvents1::DispEventAdvise((IDispatch*)m_spItems[1],&__uuidof(ItemsEvents))
;

I map the ItemAdd function as :

SINK_ENTRY_INFO(1,__uuidof(ItemsEvents), 0xf001, OnItemAdd, &ParInfoD)

How can i solve it?
Pls reply me.
Thanks.
--
Computer Ganesh


Ken Slovak - said:
An ItemAdd handler for the Inbox's Items collection would handle all emails
delivered to your Inbox no matter which email account it was sent to. You
don't really need multiple handlers for that.

The list of all email accounts for a specific Outlook profile is stored in
the registry. Much of the information there is binary and not documented.




in
outlook?
 
I can't provide any examples in C but you need to handle the ItemAdd event
for the Items collection of the alternate Inbox. Just get that folder and
its Items collection and do whatever it is you do in C to handle that event.
 
Back
Top