Easy Way to Integrate Your Application With Outlook.
Posted
by Venu Vemula
on December 12th, 2001
Here is a sample that would easily integrate with the outlook application and would respond to some usual events.
Even though there is documentation available for Outlook automation objects, the naming convention which is used is very confusing and misleading. Class 'Inspectors' can be used as a mail watcher to allow notification when a mail is opened by the user.
In the same way class 'Explorer' is used to display mails in the mail folder.
Now you know why we need this sample!!.
Note: You need to run this application only after opening Outlook.
// Following are the includes you might need to // find the actual location and modify following imports #import "C:\\Program Files\\Common Files\\Designer\\msaddndr.dll" #import "D:\\Microsoft Office\\Office\\Mso9.dll" #import "D:\\Microsoft Office\\Office\\Msoutl9.olb" ... // //connect to outlook & watch for some events if(m_outlook == 0) { if(m_outlook.CreateInstance(__uuidof(Outlook::Application)) == S_OK) { Outlook::_InspectorsPtr inspectors; //get inspectors and make event sink connection if(m_outlook->get_Inspectors(&inspectors) == S_OK) { //use helper method to sink into CEventSink::Advice( inspectors, GetIDispatch(FALSE), __uuidof(Outlook::InspectorsEvents)); } // // get explorer(mail listing window) // make event sink connetion new CEventSink(*this,m_outlook->ActiveExplorer()); } } ... // // when mail is opened in a seperate window(following // event is fired) void COutlooksampleDlg::NewInspector(IDispatch *disp) { // connect a event sink for this mail new CEventSink(*this,disp); } ... // // when mail shown in preview window void CEventSink::SelectionChange() { long count = 0; if(m_explorer != 0) { Outlook::SelectionPtr& selection =m_explorer->Selection; if(selection->get_Count(&count) == S_OK && count > 0) { Outlook::_MailItemPtr mailItem = selection->Item((short)1); //display this in edit box m_dlg.DisplayMailItem(mailItem); } } }
Downloads
Download demo project - 28 KbDownload source - 33 Kb

Comments
Originate 2013 a new color layout Nike Sense Max shoes
Posted by Tufffruntee on 04/25/2013 07:39amQualifying series Nike Air Max HomeTurf metropolis recently absolutely comes up, this series in the classic Tune Max shoes to London, Paris and Milan [url=http://www.nikeskornatet.se/nike-free-run-2-c-29/]nike free run 2 sverige[/url] the three paid glorification to the iconic conurbation of Europe, combined with the characteristics of the three cities, Air Max 1 HYP,Mood Max 90 HYP,With Max 1 and shoes such as Superiority Max 95, combined with the Hyperfuse, as by a long chalk as a order of materials, such as suede, Whether you require operational or retro-everything. It seems to me that more than Nike [url=http://www.nikeskorrea.se/nike-air-max-90-hyperfuse-c-37/]air max 90 hyperfuse[/url] shoes all star spirited decorous signature shoe series, and NSW series, all take the lead color system of the new Display Max Hyperposite exposure. Shaft light brown provoked, hyperfuse, swoosh, and are attached at the down of the yellow/orange gradient snap details, lining is a Galaxy in [url=http://www.nikeskoroutlet.se/]nike skor[/url] orange prototype garter, extraordinarily beautiful.
ReplyHow can i make similar COM for Outlook Express
Posted by parabiz on 06/13/2005 09:30amHi, How can i make the similar COM Add In for Outlook Express Your help will be greatly appreciated. Thanks, Jay
ReplyGet Selected Folder instead
Posted by Legacy on 02/08/2004 12:00amOriginally posted by: Bjoern Schultze
Anyone could explain me, how I can modify the code to Get the selected Folders instead of Message-Previews ?
ReplyProblem with Outlook and Addin.dll
Posted by Legacy on 01/28/2004 12:00amOriginally posted by: Hela Malz
I built AddIn.dll (MFC, Interface _IDTExtensibility2) for Outlook.
It has always been executed by Outlook, even it wasn't 'registered' through ... - Options - COM-Add-Ins
When I renamed AddIn.dll to AddIn1.dll, Outlook didn't execute it any more.
After renaming back to AddIn.dll Outlook still refuses to execute my AddIn.dll
I tried 'registering' my AddIn.dll through ... - Options - COM-Add-Ins, but AddIn.dll is not showed there
What can I do, that Outlook executes my dll again ?????????
ReplyAny help in modifying this appl.. as.........plz read on...
Posted by Legacy on 12/11/2003 12:00amOriginally posted by: Shahaji Bhosle
Hi
I compile and run this appl.
No pbm at all.
This example is excellent resource
for OUTLOOK add-in beginners.
I am going to modify this appl. as
i should display a messagebox without
running the application.
In my project i am adding someothat code
in SELECTION CHANGE Event.
Any Help Will be Appreciated.
Bye
Shahaji
ReplyShahaji@lelesys.com
Pune India
Catching Events such as "New Contact"
Posted by Legacy on 11/18/2003 12:00amOriginally posted by: John
How can I catch an event such as create an new contact, or
add a new folder.
Need Help !
ReplyATL/COM
Posted by Legacy on 11/04/2003 12:00amOriginally posted by: riaz
I want to add a button to the outlook toolbar
this button should also appear on teh child windows (New message window, reply window, etc)
ReplyPls Help
_MailItem
Posted by Legacy on 10/29/2002 12:00amOriginally posted by: aurel
Does anyone know how to send attachments using _MailItem?
Thanks, much.
ReplyHow to get the mail items while activating my application or out look
Posted by Legacy on 10/10/2002 12:00amOriginally posted by: Koundinya
ReplyExcellent work---I need help to get the Message ID from mailItem
Posted by Legacy on 08/13/2002 12:00amOriginally posted by: Senthil Kumaran
ReplyLoading, Please Wait ...