Outlook.COMAddIns.Item(i).Connect -> crash

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

Outlook.COMAddIns.Item(i).Connect -> crash
 
Giancarlo


Guest


I have developed 2 Add-In for outlook
The second check if the first is disabled
If disabled launch the command

Outlook.COMAddIns.Item(i).Connect := True;

for activate it


when Outlook disable Plugin because the plugin is slow
the command crash

how can I activate the plugin deactivated by outlook?
Posted 03 Oct, 2016 10:23:51 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hello Giancarlo,

The Outlook object model doesn't provide a way to bypass this. You could study the information that Outlook stores in the registry (see http://www.slipstick.com/outlook/always-load-an-outlook-addin/) and try to modify that info but I wouldn't be surprised if this is a dead end.

The other way out of this - it is probably the best one - is to find why the add-in is slow and to fix this. Check section Preventing an add-in from being disabled at https://msdn.microsoft.com/en-us/library/office/jj228679(v=office.15).aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Oct, 2016 05:01:17 Top
Giancarlo


Guest


I'm perfectly agree with you
the plug-in that Outlook disables,
contains only a small portion of your sample code:

the hooking to the new email


function GetIsFolderTracked: boolean;
procedure SetIsFolderTracked(const Value: boolean);
procedure ItemsNew(ASender: TObject; const Item: IDispatch);
...
...
  Cartelle[L] := TItems.Create(Self);
  Cartelle[L].OnItemAdd := ItemsNew;
  Cartelle[L].ConnectTo(cartella.Items);
...
...

procedure TAddInModule.ItemsNew(ASender: TObject; const Item: IDispatch);
var
  IMai : Outlook2010._MailItem;
  FMai: TMailItem; //
  i: Integer;
begin
  IMai:=nil;
  Item.QueryInterface(IID__MailItem, IMai);
  if (Assigned(IMai)) then begin
    FMai := TMailItem.Create(nil);
    FMai.ConnectTo(IMai as Outlook2000._MailItem);

      ShowMessage(  FMai.Subject );

    FreeAndNil(FMai);
    IMai:=nil;
  end;
end;



After 3-4 hours outlook decides to disable the component
Posted 04 Oct, 2016 05:43:30 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Replace ShowMessage with Windows.OutputDebugString() and use DebugView (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx) to collect debug messages.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Oct, 2016 06:32:27 Top