How to find all accounts used in Outlook?

C

ComputerGanesh

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
 
K

Ken Slovak - [MVP - Outlook]

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

ComputerGanesh

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

Matt Fletcher

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?
 
K

Ken Slovak - [MVP - 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top