Outlook events in C#

M

Marcin

I try to create Outlook 2003 add-in. I do not have much knowledge about this,
but thanks to great MSDN's article:
http://msdn.microsoft.com/office/un...ibrary/en-us/dv_vstechart/html/ol03csharp.asp
I think I will be able to manage it.

My problem concern AdvancedSearch function. I don't know how to create in C#
function that will be called when AdvancedSearch is finished and return
results. I tried something like this:
(...)
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
applicationObject =
(Microsoft.Office.Interop.Outlook.Application)application;
(…)
}
public void OnStartupComplete(ref System.Array custom)
{
applicationObject.AdvancedSearch
("Inbox","urn:schemas:mailheader:subject='Test'",false,"MySearch");
}
private void applicationObject_AdvancedSearchCompleted(object s)
{
MessageBox.Show("Search stops");
}
(…)
but it does not work.

Probably, I should add something like:
applicationObject.AdvancedSearchComplete += new
System.EventHandler(applicationObject_AdvancedSearchComplete);
but in this particular case I have error:
“The name ‘applicationObject_AdvancedSearchComplete’ does not exist in the
class or namespace…â€

What should I add/change?

TIA,
Marcin
 
M

Marcin

O.K. - found myself:
applicationObject.AdvancedSearchComplete += new
Microsoft.Office.Interop.Outlook.ApplicationEvents_11_AdvancedSearchCompleteEventHandler(applicationObject_AdvancedSearchCompleted);

.... and everything works fine!!!

Marcin
 

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