Thread: Before Send
View Single Post
  #11  
Old December 4th 08, 05:15 PM posted to microsoft.public.outlook.program_forms
BigDubb
external usenet poster
 
Posts: 21
Default Before Send

Ken,

First off thanks for the suggestion, I took your first approach and this
worked well. However, we seem to have hit an issue with send event.

For some users, meeting requests are sent twice. It is sent once when the
meeting is set up and the send button is clicked and the meeting is
'qualified' (our methodology), then when users close and reopen outlook, the
request is sent again.

I am trapping the event as follows:
_apptEvents.Send += new
Microsoft.Office.Interop.Outlook.ItemEvents_SendEv entHandler(_apptEvents_Send);

which is fired off during the FormRegionShowing event.

In the _apptEvents_Send method I just do some checking to see if the meeting
has been 'qualified' and cancel respectively.

private voide _apptEvents_Send(ref bool Cancel)
{
if(!Qualified)
{
messagebox.show("Meeting not qualified");
Cancel = true;
return;
}
}

Any ideas?

"Ken Slovak - [MVP - Outlook]" wrote:

What you're missing is what you're going to run into with methods/events
that overload the same keyword in all managed code. In this case
AppointmentItem doesn't directly expose the Send event since it uses the
same keyword as the Send method.

There are a couple of ways to do what you need to do:

1. Declare at class level an ItemEvents_Event object, say _apptEvents:
private Outlook.ItemEvents_Event _apptEvents;

Then instantiate the event handler so:
_apptEvents = (Outlook.ItemEvents_Event)_appt;
_apptEvents.Send += new Outlook.ItemEvents_SendEventHandler(myHandler);

2. An alternative is to use AppointmentItemClass:
private Outlook.AppointmentItemClass _itemClass; // class level

Then instantiate as follows:
_itemClass = (Outlook.AppointmentItemClass) _appt;
_itemClass.ItemEvents_10_Event_Send += etc.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"BigDubb" wrote in message
...
I am not seeing an Appointment.Send Event, rather an Send Method.

When trying to make the event handler for the send method I get the
following error
"Cannot assign to 'Send' because it is a 'method group' "

Here is the syntax
AppointmentItem _appt = this.OutlookItem as Outlook.AppointmentItem;
if(_appt == null)
return;

_appt.Send += new
Outlook.ApplicationEvents_11_ItemSendEventHandler( Application_ItemSend);


What am I missing?



Ads