|
Michiel van Ingen
Guest
|
Hello,
I have been able to add a custom header value to an email message that is send from Outlook using
my addin. Now I'm trying to do the same for an appointment, I'm not receiving any errors, but when
I view the properties of the received appointment, I don't see my header value. Is it even possible
to add a custom header value to an appointment?
Thank you for any information!
Michiel |
|
Posted 20 Dec, 2016 10:48:22
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Hello Michiel,
Although a meeting in the Calendar is an AppointmentItem, you never send it. Instead, you send a MeetingItem that Outlook creates to hold your appointment. Check to what item you add the custom header and from what item you retrieve it.
To simplify this work, you may want to set the flags below as follows:
- clear this flag: File | Options | Advanced | Send and Receive | Send immediately when connected
- set this flag: Send/Receive tab | expand Send/Receive Groups | Disable Scheduled Send/Receive
These settings prevent an email or meeting request from being accidentally sent; to send an email with the settings above, you need to press F9 or click the Send / Receive command.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 21 Dec, 2016 08:54:18
|
|
Top
|
|
Michiel van Ingen
Guest
|
Hello Andrei,
The idea is that a button in my ribbon sends the meeting request, if the button is clicked, the following
code is executed:
procedure TAddInModule.adxRibbonTab2Controls0Controls0Click(Sender: TObject; const RibbonControl: IRibbonControl);
var
IDsp: IDispatch;
AppointMent: AppointmentItem;
begin
try
IDsp := OutlookApp.ActiveInspector.CurrentItem;
except
end;
if Assigned(IDsp) then
try
IDsp.QueryInterface(IID__AppointmentItem, AppointMent);
if Assigned(AppointMent) then
begin
try
SetHeader(AppointMent.MAPIOBJECT as IMessage, 'hello', 'there');
try
AppointMent.Send;
except
ShowMessage('Failed to send');
end;
finally
end;
end;
AppointMent := nil;
finally
IDsp := nil;
end;
end;
This works great for an email item, but not for an appointment. I have tested to see if I have a
have a IID__MeetingItem, but that resolve to false, it is really an appointment at this point
(before sending). When it is send and I view the received item it is a MeetingItem, so when it
is send, Outlook converts the Appointment to a Meeting item. The setheader function is able to set
the header without any errors.
Can or should I convert the appointment to a meeting?
Thanks,
Michiel |
|
Posted 21 Dec, 2016 10:42:05
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
|
Posted 22 Dec, 2016 04:21:07
|
|
Top
|
|
Michiel van Ingen
Guest
|
Hello Andrei,
The link is for getting an appointment item that is already in a mailbox, I am trying to set the header
when the meeting is send so that the mailserver can read a specific value in the header and perform some
special processing on it. I'm checking the header by looking at the properties of an mail or meeting item,
and I can see my specific header value in a mail item, but not in a meeting item.
Thanks,
Michiel |
|
Posted 27 Dec, 2016 03:26:38
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Hello Michiel,
Since the TAddInModule.adxRibbonTab2Controls0Controls0Click method, which you provided above, sets the header on an appointment item, try to check if the appointment item delivered to the target machine contains that header. Alternatively, you can try to set the header on a MeetingItem when it is being sent; accordingly you will need to retrieve the header on the MeetingItem received.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 27 Dec, 2016 09:34:49
|
|
Top
|
|
Michiel van Ingen
Guest
|
Hi Andrei,
I think Outlook changes the appointment to a meeting just before the item is being send. That is the reason
why my custom header value seems to get lost. I tried to change the header just before the item is send by catching the itemsend event using a adxOutlookAppEvents and that works!! The item is now actually a meeting item, so I'm very happy to have finally found a solution.
Thanks you very much for all your help, very much appreciated!
Have a very good 2017!!
Best regards,
Michiel |
|
Posted 28 Dec, 2016 05:01:01
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Michiel,
My congratulations! Happy New Year!
Andrei Smolin
Add-in Express Team Leader |
|
Posted 28 Dec, 2016 05:08:32
|
|
Top
|
|