|
bluewwol
Posts: 26
Joined: 2022-01-21
|
Hi,
I am wanting to work on a message after Outlook has completed the send operation, I am unable to locate an event that allows this, does anyone have any advice or insights on how to achieve this?
Thanks for any assistance
-Allen |
|
Posted 15 Nov, 2022 09:21:52
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18993
Joined: 2006-05-11
|
|
Posted 15 Nov, 2022 09:47:13
|
|
Top
|
|
bluewwol
Posts: 26
Joined: 2022-01-21
|
Hi Andrei;
I noticed that the Sync Events are quite delayed. After sleuthing around I arrived at this solution which is working quite well.
For each account set in Outlook I execute this code to setup the events
objStore := ol2010.Session.Accounts.Item(i).DeliveryStore;
IFolderSent := objStore.GetDefaultFolder(olFolderSentMail);
if Assigned(IFolderSent) then
try
dMain.AccountsArray[i - 1].FItems := TItems.Create(nil);
dMain.AccountsArray[i - 1].FItems.ConnectTo(Outlook2000._Items(IFolderSent.Items));
dMain.AccountsArray[i - 1].FItems.OnItemAdd := DoItemChange;
finally
IFolderSent := nil;
end;
However I notice that my AddInFinalize code is never executed, or at least the break points into the code are never triggered. There is no exception generated and Outlook seems to have terminated normally?? Any suggestions?
procedure TAddInModule.adxCOMAddInModuleAddInFinalize(Sender: TObject);
var
i: Integer;
begin
if dMain <> nil then
begin
for i := 0 to Length(dMain.AccountsArray) - 1 do
dMain.AccountsArray[i].FItems.Free;
dMain.Free;
end;
OutlookApp.OnItemSend := nil;
if Assigned(FItems) then
FreeAndNil(FItems);
end;
-Allen |
|
Posted 17 Nov, 2022 11:23:35
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18993
Joined: 2006-05-11
|
Hello Allen,
1. It is possible to send an email without creating a copy in the Sent Items folder. You can do this programmatically- set theMailitem.SaveSentMessageFolder := nil. There?Â?Ð?és an UI option, too; I can?Â?Ð?é point you to that option at the moment, sorry. You can?Â?Ð?ét get the *current* state of that UI option; you can only find what it?Â?Ð?és value was when Outlook started.
2. This is the default behaviour of Outlook; see e.g. https://www.add-in-express.com/creating-addins-blog/2010/05/04/outlook2010-fast-shutdown/
Regards from Poland (GMT+1),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 21 Nov, 2022 04:57:17
|
|
Top
|
|
bluewwol
Posts: 26
Joined: 2022-01-21
|
Andrei;
Thank you, this did solve my finalize problem.
procedure TAddInModule.adxOutlookAppEvents1Quit(Sender: TObject);
begin
if Self.OutlookShutdownBehavior = osFast then
begin
adxCOMAddInModuleAddInFinalize(Sender);
end;
end;
|
|
Posted 21 Nov, 2022 11:50:34
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18993
Joined: 2006-05-11
|
You are welcome!
Regards from Poland (GMT+1),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 21 Nov, 2022 11:56:18
|
|
Top
|
|