Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Sun, 3 Aug 2008 18:48:15 +0300,    group: microsoft.public.platformsdk.mapi        back       


Open attachment for Outlook task item   
Hello,

I am writing a simple Exchange client event extension.
The implementation is straightforward (similar with 
http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
only I am implementing other interfaces):
- publish in registry the extension
  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
- DllMain + ExchEntryPoint which returns a pointer to the IExchExt extension 
implementation;
- in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents are also 
implemented (all methods except QI, AddRef and Release returns S_FALSE)

Environment is Outlook 2003. (Will be also 2007, but for now assume is just 
OL 2003).

Until now, the extension is loaded, events are fired, everything seems ok - 
except that only for mail items.
I succeeded to block an "open attachment" with a simple test code as (fired 
when the user attempts to open an attachment from a mail item):

(the class CExchExtAttachedFileEvents implements the interface 
IExchExtAttachedFileEvents)
STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, ULONG 
ulFlags) {
  if(lpszFile != NULL) {
    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
      return S_OK; // test 1 - block attachment if contains Sample.JPG
    }
  }
  return S_FALSE;
}

I have some hours of googling and I still have no clue why for mail items 
seems to work fine, but for task items (in fact, for anything else than mail 
items) no events are fired.
My questions are:
1. The Exchange client extensions are limited to mail items only? Or there 
is something more that should be written in registry (although I saw just 
the context and interfaces entries for registry, and not item types...). 
Perhaps and ECF file will do it?
I am still not sure if is a problem of
  - incorrect/incomplete configuration (something is missing in order to 
have events fired also for task items)
  - is an Outlook limitation (the task item attachment events really are not 
firing events outside, or not in this way, or not in OL 2003 etc.),
or
  - I am not following the correct way to reach task item attachments' 
events (I hope the latter is correct).

2. Supposing that the task item attachment events behave similarly with mail 
item events, and is just a matter of extension configuration, is the 
IExchExtAttachedFileEvents::OnOpenSzFile method called when an attachment of 
a task item is managed?
(If task items attachments are handled in the same way as mail items 
attachments, it seems natural to me to use the same interface... but I'm 
asking anyway).

3. Perhaps it is not possible (or not designed) to use this way to catch the 
task items attachments events? If this is the case, what other options do I 
have (other than a client extension way and IExchExt)?

Regards,
Cristian Amarie
date: Sun, 3 Aug 2008 18:48:15 +0300   author:   Cristian Amarie

Re: Open attachment for Outlook task item   
You need to install your ECE using an ECF file rather than a registry key 
and specify MoreContexts in "Misc Flags":
[General]
...
Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Cristian Amarie"  wrote in message 
news:OuCwYBY9IHA.1468@TK2MSFTNGP05.phx.gbl...
> Hello,
>
> I am writing a simple Exchange client event extension.
> The implementation is straightforward (similar with 
> http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
> only I am implementing other interfaces):
> - publish in registry the extension
>  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
>  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
> - DllMain + ExchEntryPoint which returns a pointer to the IExchExt 
> extension implementation;
> - in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents are 
> also implemented (all methods except QI, AddRef and Release returns 
> S_FALSE)
>
> Environment is Outlook 2003. (Will be also 2007, but for now assume is 
> just OL 2003).
>
> Until now, the extension is loaded, events are fired, everything seems 
> ok - except that only for mail items.
> I succeeded to block an "open attachment" with a simple test code as 
> (fired when the user attempts to open an attachment from a mail item):
>
> (the class CExchExtAttachedFileEvents implements the interface 
> IExchExtAttachedFileEvents)
> STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, 
> ULONG ulFlags) {
>  if(lpszFile != NULL) {
>    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
>      return S_OK; // test 1 - block attachment if contains Sample.JPG
>    }
>  }
>  return S_FALSE;
> }
>
> I have some hours of googling and I still have no clue why for mail items 
> seems to work fine, but for task items (in fact, for anything else than 
> mail items) no events are fired.
> My questions are:
> 1. The Exchange client extensions are limited to mail items only? Or there 
> is something more that should be written in registry (although I saw just 
> the context and interfaces entries for registry, and not item types...). 
> Perhaps and ECF file will do it?
> I am still not sure if is a problem of
>  - incorrect/incomplete configuration (something is missing in order to 
> have events fired also for task items)
>  - is an Outlook limitation (the task item attachment events really are 
> not firing events outside, or not in this way, or not in OL 2003 etc.),
> or
>  - I am not following the correct way to reach task item attachments' 
> events (I hope the latter is correct).
>
> 2. Supposing that the task item attachment events behave similarly with 
> mail item events, and is just a matter of extension configuration, is the 
> IExchExtAttachedFileEvents::OnOpenSzFile method called when an attachment 
> of a task item is managed?
> (If task items attachments are handled in the same way as mail items 
> attachments, it seems natural to me to use the same interface... but I'm 
> asking anyway).
>
> 3. Perhaps it is not possible (or not designed) to use this way to catch 
> the task items attachments events? If this is the case, what other options 
> do I have (other than a client extension way and IExchExt)?
>
> Regards,
> Cristian Amarie
date: Sun, 3 Aug 2008 09:17:17 -0700   author:   Dmitry Streblechenko

Re: Open attachment for Outlook task item   
1. Ok, I got rid of the registry entry and used an .ecf file as:

>>> start of file <<<
[General]
Display Name=IWOV Task Extension
Description=Performs advanced IWOV Task Management
Path="E:\iwoltkex\debug\iwoltkex.dll"
Entry Point=1
Client Version=4.0
Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly

[Exchange Client Compatibility]
Exchange Context Map=11111111111111
Exchange Interface Map=1111110

[Folder]
Folder Class=IPF
Events=OnFolderChange;OnSelectionChange
Views=Viewer

[Item]
Message Class=IPM.Note;IPM.Task
Item States=Modal;NonModal;Read;Compose
Events=OnItemChange;OnCommand;OnRead;OnReadComplete
>>> end of file <<<

Thing is, now IExchExtAttachedFileEvents methods don't get invoked (not for 
mail items), so I don't get attachment events.
OnRead and OnReadComplete are indeed correctly called also for _TaskItem 
class.

Can you point me in the right direction regarding 
IExchExtAttachedFileEvents?
Most probably, I have to specify some specific events for [Item] section 
which are not present now, only I cannot find a correlation (if any) between 
event names and what I should do in code...

The .ecf documentation from
  http://www.outlookexchange.com/articles/home/ecf.asp
is quite comprehensive in describing the .ecf files, however it is not 
saying exactly what the event names are supposed to do, just enumerated the 
supported event names.

Since when the extension was declared in registry and 
IExchExtAttachedFileEvents::OnOpenSzFile got called,
now I suppose is a matter of knowing the right thing to update in .ecf file 
to have also attachment events fired to extension as well.

Regards,
Cristian Amarie

"Dmitry Streblechenko"  wrote in message 
news:#o8O2RY9IHA.5568@TK2MSFTNGP04.phx.gbl...
> You need to install your ECE using an ECF file rather than a registry key 
> and specify MoreContexts in "Misc Flags":
> [General]
> ...
> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool
> -
> "Cristian Amarie"  wrote in message 
> news:OuCwYBY9IHA.1468@TK2MSFTNGP05.phx.gbl...
>> Hello,
>>
>> I am writing a simple Exchange client event extension.
>> The implementation is straightforward (similar with 
>> http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
>> only I am implementing other interfaces):
>> - publish in registry the extension
>>  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
>>  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
>> - DllMain + ExchEntryPoint which returns a pointer to the IExchExt 
>> extension implementation;
>> - in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents are 
>> also implemented (all methods except QI, AddRef and Release returns 
>> S_FALSE)
>>
>> Environment is Outlook 2003. (Will be also 2007, but for now assume is 
>> just OL 2003).
>>
>> Until now, the extension is loaded, events are fired, everything seems 
>> ok - except that only for mail items.
>> I succeeded to block an "open attachment" with a simple test code as 
>> (fired when the user attempts to open an attachment from a mail item):
>>
>> (the class CExchExtAttachedFileEvents implements the interface 
>> IExchExtAttachedFileEvents)
>> STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, 
>> ULONG ulFlags) {
>>  if(lpszFile != NULL) {
>>    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
>>      return S_OK; // test 1 - block attachment if contains Sample.JPG
>>    }
>>  }
>>  return S_FALSE;
>> }
>>
>> I have some hours of googling and I still have no clue why for mail items 
>> seems to work fine, but for task items (in fact, for anything else than 
>> mail items) no events are fired.
>> My questions are:
>> 1. The Exchange client extensions are limited to mail items only? Or 
>> there is something more that should be written in registry (although I 
>> saw just the context and interfaces entries for registry, and not item 
>> types...). Perhaps and ECF file will do it?
>> I am still not sure if is a problem of
>>  - incorrect/incomplete configuration (something is missing in order to 
>> have events fired also for task items)
>>  - is an Outlook limitation (the task item attachment events really are 
>> not firing events outside, or not in this way, or not in OL 2003 etc.),
>> or
>>  - I am not following the correct way to reach task item attachments' 
>> events (I hope the latter is correct).
>>
>> 2. Supposing that the task item attachment events behave similarly with 
>> mail item events, and is just a matter of extension configuration, is the 
>> IExchExtAttachedFileEvents::OnOpenSzFile method called when an attachment 
>> of a task item is managed?
>> (If task items attachments are handled in the same way as mail items 
>> attachments, it seems natural to me to use the same interface... but I'm 
>> asking anyway).
>>
>> 3. Perhaps it is not possible (or not designed) to use this way to catch 
>> the task items attachments events? If this is the case, what other 
>> options do I have (other than a client extension way and IExchExt)?
>>
>> Regards,
>> Cristian Amarie
>
>
date: Mon, 4 Aug 2008 19:33:43 +0300   author:   Cristian Amarie

Re: Open attachment for Outlook task item   
I stopped using ECE a while back (had no reason, plus I doubt the next 
version of Outlook will still support ECE), but below is what I use in 
Outlook under Outlook 2003 or below.
Try to specify all the interfaces. Make sure you delete extend.dat before 
restarting Outlook - otherwise it will use the cached version of your ECF 
file.

[General]
Display Name=Outlook Spy
Description=Displays Outlook and MAPI Objects
Path=%DLLNAME%
Entry Point=1
Client Version=4.0
Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly

[Exchange Client Compatibility]
Exchange Context Map=11111111111111
Exchange Interface Map=11111111

[Application]
Events=OnStartup;OnShutdown

[Session]
Events=OnLogon;OnLogoff;OnDelivery

[Property Sheet]
Events=AddPropSheetPages
Property Sheet Dialogs=ToolsOptions

[Folder]
Folder Class=IPF
Menu 
Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
Events=AllCommands;InstallCommands;AddPropSheetPages;Install;OnFolderChange;OnSelectionChange
Views=Viewer

[Item]
Message Class=IPM
Item States=Modal;NonModal;Read;Compose
Menu 
Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
Events=AllCommands;InstallCommands;OnItemChange;OnCommand



-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Cristian Amarie"  wrote in message 
news:834BC251-B4F2-4A35-A324-B27421578179@microsoft.com...
> 1. Ok, I got rid of the registry entry and used an .ecf file as:
>
>>>> start of file <<<
> [General]
> Display Name=IWOV Task Extension
> Description=Performs advanced IWOV Task Management
> Path="E:\iwoltkex\debug\iwoltkex.dll"
> Entry Point=1
> Client Version=4.0
> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>
> [Exchange Client Compatibility]
> Exchange Context Map=11111111111111
> Exchange Interface Map=1111110
>
> [Folder]
> Folder Class=IPF
> Events=OnFolderChange;OnSelectionChange
> Views=Viewer
>
> [Item]
> Message Class=IPM.Note;IPM.Task
> Item States=Modal;NonModal;Read;Compose
> Events=OnItemChange;OnCommand;OnRead;OnReadComplete
>>>> end of file <<<
>
> Thing is, now IExchExtAttachedFileEvents methods don't get invoked (not 
> for mail items), so I don't get attachment events.
> OnRead and OnReadComplete are indeed correctly called also for _TaskItem 
> class.
>
> Can you point me in the right direction regarding 
> IExchExtAttachedFileEvents?
> Most probably, I have to specify some specific events for [Item] section 
> which are not present now, only I cannot find a correlation (if any) 
> between event names and what I should do in code...
>
> The .ecf documentation from
>  http://www.outlookexchange.com/articles/home/ecf.asp
> is quite comprehensive in describing the .ecf files, however it is not 
> saying exactly what the event names are supposed to do, just enumerated 
> the supported event names.
>
> Since when the extension was declared in registry and 
> IExchExtAttachedFileEvents::OnOpenSzFile got called,
> now I suppose is a matter of knowing the right thing to update in .ecf 
> file to have also attachment events fired to extension as well.
>
> Regards,
> Cristian Amarie
>
> "Dmitry Streblechenko"  wrote in message 
> news:#o8O2RY9IHA.5568@TK2MSFTNGP04.phx.gbl...
>> You need to install your ECE using an ECF file rather than a registry key 
>> and specify MoreContexts in "Misc Flags":
>> [General]
>> ...
>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy  - Outlook, CDO
>> and MAPI Developer Tool
>> -
>> "Cristian Amarie"  wrote in message 
>> news:OuCwYBY9IHA.1468@TK2MSFTNGP05.phx.gbl...
>>> Hello,
>>>
>>> I am writing a simple Exchange client event extension.
>>> The implementation is straightforward (similar with 
>>> http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
>>> only I am implementing other interfaces):
>>> - publish in registry the extension
>>>  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
>>>  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
>>> - DllMain + ExchEntryPoint which returns a pointer to the IExchExt 
>>> extension implementation;
>>> - in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents are 
>>> also implemented (all methods except QI, AddRef and Release returns 
>>> S_FALSE)
>>>
>>> Environment is Outlook 2003. (Will be also 2007, but for now assume is 
>>> just OL 2003).
>>>
>>> Until now, the extension is loaded, events are fired, everything seems 
>>> ok - except that only for mail items.
>>> I succeeded to block an "open attachment" with a simple test code as 
>>> (fired when the user attempts to open an attachment from a mail item):
>>>
>>> (the class CExchExtAttachedFileEvents implements the interface 
>>> IExchExtAttachedFileEvents)
>>> STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, 
>>> ULONG ulFlags) {
>>>  if(lpszFile != NULL) {
>>>    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
>>>      return S_OK; // test 1 - block attachment if contains Sample.JPG
>>>    }
>>>  }
>>>  return S_FALSE;
>>> }
>>>
>>> I have some hours of googling and I still have no clue why for mail 
>>> items seems to work fine, but for task items (in fact, for anything else 
>>> than mail items) no events are fired.
>>> My questions are:
>>> 1. The Exchange client extensions are limited to mail items only? Or 
>>> there is something more that should be written in registry (although I 
>>> saw just the context and interfaces entries for registry, and not item 
>>> types...). Perhaps and ECF file will do it?
>>> I am still not sure if is a problem of
>>>  - incorrect/incomplete configuration (something is missing in order to 
>>> have events fired also for task items)
>>>  - is an Outlook limitation (the task item attachment events really are 
>>> not firing events outside, or not in this way, or not in OL 2003 etc.),
>>> or
>>>  - I am not following the correct way to reach task item attachments' 
>>> events (I hope the latter is correct).
>>>
>>> 2. Supposing that the task item attachment events behave similarly with 
>>> mail item events, and is just a matter of extension configuration, is 
>>> the IExchExtAttachedFileEvents::OnOpenSzFile method called when an 
>>> attachment of a task item is managed?
>>> (If task items attachments are handled in the same way as mail items 
>>> attachments, it seems natural to me to use the same interface... but I'm 
>>> asking anyway).
>>>
>>> 3. Perhaps it is not possible (or not designed) to use this way to catch 
>>> the task items attachments events? If this is the case, what other 
>>> options do I have (other than a client extension way and IExchExt)?
>>>
>>> Regards,
>>> Cristian Amarie
>>
>>
date: Mon, 4 Aug 2008 11:41:25 -0700   author:   Dmitry Streblechenko

Re: Open attachment for Outlook task item   
Probably you're true about ECE support on future OL version. Too bad the OOM 
is not fully replacing the ECEs (AFAIK).

Back to the ECE - I used a .ecf, and the result is this:
- registry declaration:
  - IExchExtMessageEvents::OnRead is called just for mail items;
  - IExchExtAttachedFileEvents methods are called just for mail items.
- .ecf declaration (with registry or not):
  - IExchExtMessageEvents::OnRead is called for all item types;
  - IExchExtAttachedFileEvents do not get called.
  (The strange thing is that QueryInterface on 
IID_IExchExtAttachedFileEvents is called on all cases!).

Seems registry declaration behaves correctly regarding IExchExt... interface 
calling, while .ecf declaration is more complete regarding definition but 
lacks proper event support for attachments (i.e. in [Item] section it is no 
known possibility to add attachment-related events).
I suppose this is because the [Item]Events=... section refers to the events 
referring to items classes (such as IPM.Note, IPM.Task etc.) but attachments 
are not classes.

Since probably there is no way to specify
  "process IPM.Task items, but fire me back events not on task item, but on 
attachments of task item"
I think the .ecf won't help in this particular case either.

If the .ecf would have a syntax such as
  [Item]
  Message Class=IPM.Task
  Event=[...item class events]; Attachment!OnOpenSzFile; ...
so in a format like [<event-source>!]<event-name>; without <event-source> 
behaving like now (item event), and indicating the optional <event-source> 
would mean the part of the item that fired the event (with values such as 
Attachment, Form, View, Command etc. ...) - but I suppose I'm in dreamland 
now :) since ECE support is slowly dropping, as you said...

Still, I wonder why the IExchExtAttachedFileEvents methods get called when 
registry declaration is used without an .ecf.
Would be, by any chance, some undocumented registry entry to be specified 
other that the known format [version];[path];[entry];[exchange 
map];[interface map];[provider], that would enable the attachments event 
also for non-IPM.Note items?

Regards,
Cristian Amarie

P.S. This is the used .ecf
-= START OF ECF =-
[General]
Display Name=IWOV Task Extension
Description=Performs advanced IWOV Task Management
Path="iwoltkex.dll"
Entry Point=1
Client Version=4.0
Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly

[Exchange Client Compatibility]
Exchange Registry=0
Exchange Extension Key="iwoltkex"
Exchange Context Map=11111111111111
Exchange Interface Map=11111111

[Folder]
Folder Class=IPF
Events=AllCommands;InstallCommands;AddPropSheetPages;Install;OnFolderChange;OnSelectionChange
Menu 
Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
Views=Viewer

[Item]
Message Class=IPM
Item States=Modal;NonModal;Read;Compose
Events=AllCommands;OnItemChange;OnCommand;InstallCommands;OnRead;OnReadComplete
Menu 
Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
-= END OF ECF =-

"Dmitry Streblechenko"  wrote in message 
news:#P6A0Gm9IHA.5668@TK2MSFTNGP04.phx.gbl...
> I stopped using ECE a while back (had no reason, plus I doubt the next 
> version of Outlook will still support ECE), but below is what I use in 
> Outlook under Outlook 2003 or below.
> Try to specify all the interfaces. Make sure you delete extend.dat before 
> restarting Outlook - otherwise it will use the cached version of your ECF 
> file.
>
> [General]
> Display Name=Outlook Spy
> Description=Displays Outlook and MAPI Objects
> Path=%DLLNAME%
> Entry Point=1
> Client Version=4.0
> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>
> [Exchange Client Compatibility]
> Exchange Context Map=11111111111111
> Exchange Interface Map=11111111
>
> [Application]
> Events=OnStartup;OnShutdown
>
> [Session]
> Events=OnLogon;OnLogoff;OnDelivery
>
> [Property Sheet]
> Events=AddPropSheetPages
> Property Sheet Dialogs=ToolsOptions
>
> [Folder]
> Folder Class=IPF
> Menu 
> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
> Events=AllCommands;InstallCommands;AddPropSheetPages;Install;OnFolderChange;OnSelectionChange
> Views=Viewer
>
> [Item]
> Message Class=IPM
> Item States=Modal;NonModal;Read;Compose
> Menu 
> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
> Events=AllCommands;InstallCommands;OnItemChange;OnCommand
>
>
>
> -- 
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool
> -
> "Cristian Amarie"  wrote in message 
> news:834BC251-B4F2-4A35-A324-B27421578179@microsoft.com...
>> 1. Ok, I got rid of the registry entry and used an .ecf file as:
>>
>>>>> start of file <<<
>> [General]
>> Display Name=IWOV Task Extension
>> Description=Performs advanced IWOV Task Management
>> Path="E:\iwoltkex\debug\iwoltkex.dll"
>> Entry Point=1
>> Client Version=4.0
>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>
>> [Exchange Client Compatibility]
>> Exchange Context Map=11111111111111
>> Exchange Interface Map=1111110
>>
>> [Folder]
>> Folder Class=IPF
>> Events=OnFolderChange;OnSelectionChange
>> Views=Viewer
>>
>> [Item]
>> Message Class=IPM.Note;IPM.Task
>> Item States=Modal;NonModal;Read;Compose
>> Events=OnItemChange;OnCommand;OnRead;OnReadComplete
>>>>> end of file <<<
>>
>> Thing is, now IExchExtAttachedFileEvents methods don't get invoked (not 
>> for mail items), so I don't get attachment events.
>> OnRead and OnReadComplete are indeed correctly called also for _TaskItem 
>> class.
>>
>> Can you point me in the right direction regarding 
>> IExchExtAttachedFileEvents?
>> Most probably, I have to specify some specific events for [Item] section 
>> which are not present now, only I cannot find a correlation (if any) 
>> between event names and what I should do in code...
>>
>> The .ecf documentation from
>>  http://www.outlookexchange.com/articles/home/ecf.asp
>> is quite comprehensive in describing the .ecf files, however it is not 
>> saying exactly what the event names are supposed to do, just enumerated 
>> the supported event names.
>>
>> Since when the extension was declared in registry and 
>> IExchExtAttachedFileEvents::OnOpenSzFile got called,
>> now I suppose is a matter of knowing the right thing to update in .ecf 
>> file to have also attachment events fired to extension as well.
>>
>> Regards,
>> Cristian Amarie
>>
>> "Dmitry Streblechenko"  wrote in message 
>> news:#o8O2RY9IHA.5568@TK2MSFTNGP04.phx.gbl...
>>> You need to install your ECE using an ECF file rather than a registry 
>>> key and specify MoreContexts in "Misc Flags":
>>> [General]
>>> ...
>>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>>
>>>
>>> Dmitry Streblechenko (MVP)
>>> http://www.dimastr.com/
>>> OutlookSpy  - Outlook, CDO
>>> and MAPI Developer Tool
>>> -
>>> "Cristian Amarie"  wrote in message 
>>> news:OuCwYBY9IHA.1468@TK2MSFTNGP05.phx.gbl...
>>>> Hello,
>>>>
>>>> I am writing a simple Exchange client event extension.
>>>> The implementation is straightforward (similar with 
>>>> http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
>>>> only I am implementing other interfaces):
>>>> - publish in registry the extension
>>>>  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
>>>>  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
>>>> - DllMain + ExchEntryPoint which returns a pointer to the IExchExt 
>>>> extension implementation;
>>>> - in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents are 
>>>> also implemented (all methods except QI, AddRef and Release returns 
>>>> S_FALSE)
>>>>
>>>> Environment is Outlook 2003. (Will be also 2007, but for now assume is 
>>>> just OL 2003).
>>>>
>>>> Until now, the extension is loaded, events are fired, everything seems 
>>>> ok - except that only for mail items.
>>>> I succeeded to block an "open attachment" with a simple test code as 
>>>> (fired when the user attempts to open an attachment from a mail item):
>>>>
>>>> (the class CExchExtAttachedFileEvents implements the interface 
>>>> IExchExtAttachedFileEvents)
>>>> STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, 
>>>> ULONG ulFlags) {
>>>>  if(lpszFile != NULL) {
>>>>    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
>>>>      return S_OK; // test 1 - block attachment if contains Sample.JPG
>>>>    }
>>>>  }
>>>>  return S_FALSE;
>>>> }
>>>>
>>>> I have some hours of googling and I still have no clue why for mail 
>>>> items seems to work fine, but for task items (in fact, for anything 
>>>> else than mail items) no events are fired.
>>>> My questions are:
>>>> 1. The Exchange client extensions are limited to mail items only? Or 
>>>> there is something more that should be written in registry (although I 
>>>> saw just the context and interfaces entries for registry, and not item 
>>>> types...). Perhaps and ECF file will do it?
>>>> I am still not sure if is a problem of
>>>>  - incorrect/incomplete configuration (something is missing in order to 
>>>> have events fired also for task items)
>>>>  - is an Outlook limitation (the task item attachment events really are 
>>>> not firing events outside, or not in this way, or not in OL 2003 etc.),
>>>> or
>>>>  - I am not following the correct way to reach task item attachments' 
>>>> events (I hope the latter is correct).
>>>>
>>>> 2. Supposing that the task item attachment events behave similarly with 
>>>> mail item events, and is just a matter of extension configuration, is 
>>>> the IExchExtAttachedFileEvents::OnOpenSzFile method called when an 
>>>> attachment of a task item is managed?
>>>> (If task items attachments are handled in the same way as mail items 
>>>> attachments, it seems natural to me to use the same interface... but 
>>>> I'm asking anyway).
>>>>
>>>> 3. Perhaps it is not possible (or not designed) to use this way to 
>>>> catch the task items attachments events? If this is the case, what 
>>>> other options do I have (other than a client extension way and 
>>>> IExchExt)?
>>>>
>>>> Regards,
>>>> Cristian Amarie
>>>
>>>
>
>
date: Wed, 6 Aug 2008 11:36:38 +0300   author:   Cristian Amarie

Re: Open attachment for Outlook task item   
I don't know, you migth want to open a support case with MS - they are the 
only ones who could run Outlook under a debugger and see what's going on...

-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Cristian Amarie"  wrote in message 
news:C9BFD4DE-E662-493A-9F42-F5A226161D7F@microsoft.com...
> Probably you're true about ECE support on future OL version. Too bad the 
> OOM is not fully replacing the ECEs (AFAIK).
>
> Back to the ECE - I used a .ecf, and the result is this:
> - registry declaration:
>  - IExchExtMessageEvents::OnRead is called just for mail items;
>  - IExchExtAttachedFileEvents methods are called just for mail items.
> - .ecf declaration (with registry or not):
>  - IExchExtMessageEvents::OnRead is called for all item types;
>  - IExchExtAttachedFileEvents do not get called.
>  (The strange thing is that QueryInterface on 
> IID_IExchExtAttachedFileEvents is called on all cases!).
>
> Seems registry declaration behaves correctly regarding IExchExt... 
> interface calling, while .ecf declaration is more complete regarding 
> definition but lacks proper event support for attachments (i.e. in [Item] 
> section it is no known possibility to add attachment-related events).
> I suppose this is because the [Item]Events=... section refers to the 
> events referring to items classes (such as IPM.Note, IPM.Task etc.) but 
> attachments are not classes.
>
> Since probably there is no way to specify
>  "process IPM.Task items, but fire me back events not on task item, but on 
> attachments of task item"
> I think the .ecf won't help in this particular case either.
>
> If the .ecf would have a syntax such as
>  [Item]
>  Message Class=IPM.Task
>  Event=[...item class events]; Attachment!OnOpenSzFile; ...
> so in a format like [<event-source>!]<event-name>; without <event-source> 
> behaving like now (item event), and indicating the optional <event-source> 
> would mean the part of the item that fired the event (with values such as 
> Attachment, Form, View, Command etc. ...) - but I suppose I'm in dreamland 
> now :) since ECE support is slowly dropping, as you said...
>
> Still, I wonder why the IExchExtAttachedFileEvents methods get called when 
> registry declaration is used without an .ecf.
> Would be, by any chance, some undocumented registry entry to be specified 
> other that the known format [version];[path];[entry];[exchange 
> map];[interface map];[provider], that would enable the attachments event 
> also for non-IPM.Note items?
>
> Regards,
> Cristian Amarie
>
> P.S. This is the used .ecf
> -= START OF ECF =-
> [General]
> Display Name=IWOV Task Extension
> Description=Performs advanced IWOV Task Management
> Path="iwoltkex.dll"
> Entry Point=1
> Client Version=4.0
> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>
> [Exchange Client Compatibility]
> Exchange Registry=0
> Exchange Extension Key="iwoltkex"
> Exchange Context Map=11111111111111
> Exchange Interface Map=11111111
>
> [Folder]
> Folder Class=IPF
> Events=AllCommands;InstallCommands;AddPropSheetPages;Install;OnFolderChange;OnSelectionChange
> Menu 
> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
> Views=Viewer
>
> [Item]
> Message Class=IPM
> Item States=Modal;NonModal;Read;Compose
> Events=AllCommands;OnItemChange;OnCommand;InstallCommands;OnRead;OnReadComplete
> Menu 
> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
> -= END OF ECF =-
>
> "Dmitry Streblechenko"  wrote in message 
> news:#P6A0Gm9IHA.5668@TK2MSFTNGP04.phx.gbl...
>> I stopped using ECE a while back (had no reason, plus I doubt the next 
>> version of Outlook will still support ECE), but below is what I use in 
>> Outlook under Outlook 2003 or below.
>> Try to specify all the interfaces. Make sure you delete extend.dat before 
>> restarting Outlook - otherwise it will use the cached version of your ECF 
>> file.
>>
>> [General]
>> Display Name=Outlook Spy
>> Description=Displays Outlook and MAPI Objects
>> Path=%DLLNAME%
>> Entry Point=1
>> Client Version=4.0
>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>
>> [Exchange Client Compatibility]
>> Exchange Context Map=11111111111111
>> Exchange Interface Map=11111111
>>
>> [Application]
>> Events=OnStartup;OnShutdown
>>
>> [Session]
>> Events=OnLogon;OnLogoff;OnDelivery
>>
>> [Property Sheet]
>> Events=AddPropSheetPages
>> Property Sheet Dialogs=ToolsOptions
>>
>> [Folder]
>> Folder Class=IPF
>> Menu 
>> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
>> Events=AllCommands;InstallCommands;AddPropSheetPages;Install;OnFolderChange;OnSelectionChange
>> Views=Viewer
>>
>> [Item]
>> Message Class=IPM
>> Item States=Modal;NonModal;Read;Compose
>> Menu 
>> Drops=File;Edit;View;Insert;Format;Tools;Compose;Help;Main;Toolbar;Contact;Calendar;Note;Task;Journal;FileFolder
>> Events=AllCommands;InstallCommands;OnItemChange;OnCommand
>>
>>
>>
>> -- 
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy  - Outlook, CDO
>> and MAPI Developer Tool
>> -
>> "Cristian Amarie"  wrote in message 
>> news:834BC251-B4F2-4A35-A324-B27421578179@microsoft.com...
>>> 1. Ok, I got rid of the registry entry and used an .ecf file as:
>>>
>>>>>> start of file <<<
>>> [General]
>>> Display Name=IWOV Task Extension
>>> Description=Performs advanced IWOV Task Management
>>> Path="E:\iwoltkex\debug\iwoltkex.dll"
>>> Entry Point=1
>>> Client Version=4.0
>>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>>
>>> [Exchange Client Compatibility]
>>> Exchange Context Map=11111111111111
>>> Exchange Interface Map=1111110
>>>
>>> [Folder]
>>> Folder Class=IPF
>>> Events=OnFolderChange;OnSelectionChange
>>> Views=Viewer
>>>
>>> [Item]
>>> Message Class=IPM.Note;IPM.Task
>>> Item States=Modal;NonModal;Read;Compose
>>> Events=OnItemChange;OnCommand;OnRead;OnReadComplete
>>>>>> end of file <<<
>>>
>>> Thing is, now IExchExtAttachedFileEvents methods don't get invoked (not 
>>> for mail items), so I don't get attachment events.
>>> OnRead and OnReadComplete are indeed correctly called also for _TaskItem 
>>> class.
>>>
>>> Can you point me in the right direction regarding 
>>> IExchExtAttachedFileEvents?
>>> Most probably, I have to specify some specific events for [Item] section 
>>> which are not present now, only I cannot find a correlation (if any) 
>>> between event names and what I should do in code...
>>>
>>> The .ecf documentation from
>>>  http://www.outlookexchange.com/articles/home/ecf.asp
>>> is quite comprehensive in describing the .ecf files, however it is not 
>>> saying exactly what the event names are supposed to do, just enumerated 
>>> the supported event names.
>>>
>>> Since when the extension was declared in registry and 
>>> IExchExtAttachedFileEvents::OnOpenSzFile got called,
>>> now I suppose is a matter of knowing the right thing to update in .ecf 
>>> file to have also attachment events fired to extension as well.
>>>
>>> Regards,
>>> Cristian Amarie
>>>
>>> "Dmitry Streblechenko"  wrote in message 
>>> news:#o8O2RY9IHA.5568@TK2MSFTNGP04.phx.gbl...
>>>> You need to install your ECE using an ECF file rather than a registry 
>>>> key and specify MoreContexts in "Misc Flags":
>>>> [General]
>>>> ...
>>>> Misc Flags=NoOptimizeInterfaceMap;MoreContexts;InstallCommandsEarly
>>>>
>>>>
>>>> Dmitry Streblechenko (MVP)
>>>> http://www.dimastr.com/
>>>> OutlookSpy  - Outlook, CDO
>>>> and MAPI Developer Tool
>>>> -
>>>> "Cristian Amarie"  wrote in message 
>>>> news:OuCwYBY9IHA.1468@TK2MSFTNGP05.phx.gbl...
>>>>> Hello,
>>>>>
>>>>> I am writing a simple Exchange client event extension.
>>>>> The implementation is straightforward (similar with 
>>>>> http://www.ssuet.edu.pk/taimoor/books/0-672-30928-9/ch12.htm#RegisteringExtensions - 
>>>>> only I am implementing other interfaces):
>>>>> - publish in registry the extension
>>>>>  key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Extensions
>>>>>  REG_SZ value: TextExtension= 4.0;C:\...\SampleExt.DLL;1
>>>>> - DllMain + ExchEntryPoint which returns a pointer to the IExchExt 
>>>>> extension implementation;
>>>>> - in addition, IExchExtAttachedFileEvents and IExchExtMessageEvents 
>>>>> are also implemented (all methods except QI, AddRef and Release 
>>>>> returns S_FALSE)
>>>>>
>>>>> Environment is Outlook 2003. (Will be also 2007, but for now assume is 
>>>>> just OL 2003).
>>>>>
>>>>> Until now, the extension is loaded, events are fired, everything seems 
>>>>> ok - except that only for mail items.
>>>>> I succeeded to block an "open attachment" with a simple test code as 
>>>>> (fired when the user attempts to open an attachment from a mail item):
>>>>>
>>>>> (the class CExchExtAttachedFileEvents implements the interface 
>>>>> IExchExtAttachedFileEvents)
>>>>> STDMETHODIMP CExchExtAttachedFileEvents::OnOpenSzFile(LPTSTR lpszFile, 
>>>>> ULONG ulFlags) {
>>>>>  if(lpszFile != NULL) {
>>>>>    if(_tcsstr(lpszFile, _T("Sample.JPG")) != NULL) {
>>>>>      return S_OK; // test 1 - block attachment if contains Sample.JPG
>>>>>    }
>>>>>  }
>>>>>  return S_FALSE;
>>>>> }
>>>>>
>>>>> I have some hours of googling and I still have no clue why for mail 
>>>>> items seems to work fine, but for task items (in fact, for anything 
>>>>> else than mail items) no events are fired.
>>>>> My questions are:
>>>>> 1. The Exchange client extensions are limited to mail items only? Or 
>>>>> there is something more that should be written in registry (although I 
>>>>> saw just the context and interfaces entries for registry, and not item 
>>>>> types...). Perhaps and ECF file will do it?
>>>>> I am still not sure if is a problem of
>>>>>  - incorrect/incomplete configuration (something is missing in order 
>>>>> to have events fired also for task items)
>>>>>  - is an Outlook limitation (the task item attachment events really 
>>>>> are not firing events outside, or not in this way, or not in OL 2003 
>>>>> etc.),
>>>>> or
>>>>>  - I am not following the correct way to reach task item attachments' 
>>>>> events (I hope the latter is correct).
>>>>>
>>>>> 2. Supposing that the task item attachment events behave similarly 
>>>>> with mail item events, and is just a matter of extension 
>>>>> configuration, is the IExchExtAttachedFileEvents::OnOpenSzFile method 
>>>>> called when an attachment of a task item is managed?
>>>>> (If task items attachments are handled in the same way as mail items 
>>>>> attachments, it seems natural to me to use the same interface... but 
>>>>> I'm asking anyway).
>>>>>
>>>>> 3. Perhaps it is not possible (or not designed) to use this way to 
>>>>> catch the task items attachments events? If this is the case, what 
>>>>> other options do I have (other than a client extension way and 
>>>>> IExchExt)?
>>>>>
>>>>> Regards,
>>>>> Cristian Amarie
>>>>
>>>>
>>
>>
date: Wed, 6 Aug 2008 09:20:06 -0700   author:   Dmitry Streblechenko

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us