PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Interoperability Problem with AdvancedSearchCompleteEvent Handler in C#

Reply

Problem with AdvancedSearchCompleteEvent Handler in C#

 
Thread Tools Rate Thread
Old 02-07-2004, 04:50 PM   #1
piyush
Guest
 
Posts: n/a
Default Problem with AdvancedSearchCompleteEvent Handler in C#


I am trying to use AdvancedSearch feature of Outlook 2003 and
processing the results from the search. I am not able to get this
piece of code running - please advice.

The event handler doesnt get called at all and an exception is raised.
The exception being thrown is "System.InvalidCastException".
Additional Information : No such interface supported.

public class blah {
private Outlook.ApplicationClass ola;
private Outlook.NameSpace olns;
private Outlook.MAPIFolder inboxFolder;

public blah () {
ola = new Outlook.ApplicationClass();
olns = ola.GetNameSpace ("MAPI");

// now add the event handler (myeventhandler)
ola.Session.Application.AdvancedSearchComplete += new
Outlook.ApplicationEvents_11_AdvancedSearchCompleteEventHandler(this.myeventhandler);
}

public void displayMails (String number_)
{
Outlook.Search olsearch. = ola.AdvancedSearch ("Contact",
"urn:schemas:contact:sn LIKE '%Bill%'", false, "complete");

...
}

void eventhandler (Outlook.Search olsearch)
{
...
}

I dont have a very good understanding of the events but has it
something got to with having System.EventArgs specified somewhere ..
if so where ?

Thanks in advance !
Piyush
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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