Outlook adxForm repaint or refresh on incoming email like on switching folders

Add-in Express™ Support Service
That's what is more important than anything else

Only registered users are allowed to subscribe.
Outlook adxForm repaint or refresh on incoming email like on switching folders
 
Subscribe
MirkoB




Posts: 10
Joined: 2019-04-02
Hi Andrei,

first of all, thanks for all the help!

I managed to get the active instance of the form by using a function from Dmitry.

I'm a bit blocked now :) so how do I get to invoke the method fillnotesgrid on the instance I got?


function TAddInModule.GetFormByExplorer(const AExplorer: _Explorer): TadxOLForm;
var
  i: integer;
  adxForm: TadxOLForm;
begin
  Result := nil;
  for i := 0 to adxOlFormsManager1.Items[0].FormInstanceCount - 1 do begin
    adxForm := adxOlFormsManager1.Items[0].FormInstances[i];
    if Self.GetOutlookWindowHandle(adxForm.ExplorerObj) = Self.GetOutlookWindowHandle(AExplorer) then begin
      Result := adxForm;
      Break;
    end;
  end;
end;


procedure TAddInModule.DoItemAdd(ASender: TObject; const Item: IDispatch);
var
IMail: MailItem;
IExp: _Explorer;
actForm : TadxOLForm;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__MailItem, IMail);
if Assigned(IMail) then
try
if IMail.UnRead then begin
if ContainsText(IMail.Subject,'Phone Note') = True then
begin
actForm := GetFormByExplorer(OutlookApp.ActiveExplorer);
//invoke fillnotesgrid on actForm ???
end;
end;
finally
IMail := nil;
end;
end;
end;

Best regards

Mirko
Posted 10 Apr, 2019 03:08:10 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
Hello Mirko,

TadxOlForm1(actForm).fillnotesgrid();

Make sure actForm is not nil.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Apr, 2019 05:01:10 Top
MirkoB




Posts: 10
Joined: 2019-04-02
Hello Andrei,

this works perfectly ! Thanks a lot !!!

Best regards

Mirko
Posted 10 Apr, 2019 07:14:36 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Apr, 2019 07:28:41 Top