Prob OnitemAdd

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

Prob OnitemAdd
Prob OnitemAdd 
Karim




Posts: 170
Joined: 2006-01-02
Hi,

I have an old add-ins that worked several years in TSE . but since a
server migration Exchange 2010 with A SERVER 2008 i have problem.
The problem is, the event "OnitemAdd" not fire .But all other functionnality works.

Before (when "OnitemAdd" works) it's Exchange 2003 with server 2003.

It is difficult for me to debug because it is a client.

IMPORTANTE : In tse Outlook 2003 is use

I Compil Add-ins with your new update, but a have same problem

Thanks


My code looks like this :


uses {...,} Outlook2000;

type
//...

TAddInModule = class(TadxCOMAddInModule)
procedure adxCOMAddInModuleAddInInitialize(Sender: TObject);
procedure adxCOMAddInModuleAddInFinalize(Sender: TObject);
private
FItems: TItems;
protected
procedure DoItemAdd(ASender: TObject; const Item: IDispatch);
public
end;

implementation

{$R *.dfm}

procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
var
IFolderInbox: MAPIFolder;
begin
FItems := nil;
if Assigned(OutlookApp) then begin
IFolderInbox := OutlookApp.GetNamespace('MAPI').GetDefaultFolder(olFolderInbox);
if Assigned(IFolderInbox) then
try
FItems := TItems.Create(nil);
FItems.ConnectTo(IFolderInbox.Items);
FItems.OnItemAdd := DoItemAdd;
finally
IFolderInbox := nil;
end;
end;
end;
Posted 22 May, 2012 11:09:44 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Karim,

Are there any scenarios in which the event works? Have you tried copying/moving an email into Inbox?

Is this Cached or Non-cached Exchange mode?


Andrei Smolin
Add-in Express Team Leader
Posted 23 May, 2012 04:47:26 Top
Karim




Posts: 170
Joined: 2006-01-02
Hi Andrei,


In Client TSE "Non-cached Exchange mode" is use


But I resolve my problem with this link :

http://blogs.msdn.com/b/emeamsgdev/archive/2012/02/07/exchange-2010-and-outlook-2003-itemadd-event-does-not-fire-in-online-mode.aspx

solution

procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
var
IFolderInbox: MAPIFolder;
begin
FItems := nil;
if Assigned(OutlookApp) then begin
IFolderInbox := OutlookApp.GetNamespace('MAPI').GetDefaultFolder(olFolderInbox);

IFolderInbox.Items.GetFirst; // <-------Add this property

if Assigned(IFolderInbox) then
try
FItems := TItems.Create(nil);
FItems.ConnectTo(IFolderInbox.Items);
FItems.OnItemAdd := DoItemAdd;
finally
IFolderInbox := nil;
end;
end;
end;

Karim
Posted 23 May, 2012 06:29:57 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Karim,

Many thanks for posting this solution here!


Andrei Smolin
Add-in Express Team Leader
Posted 23 May, 2012 06:37:56 Top