Before a few months ago I knew little of Microsoft Exchange. Now I know a moderate amount. Which is alot more than I'd ever want to know. The most interesting aspect of developing for Exchange is the abundance of not information about it - Look all over the internet and you will find tonnes of information not about Exchange.
This huge amount of not documentation, and not example code has shortened my life by many many years. At least a few of these years went in to attempting to follow the Microsoft knowledge base article Writing Managed Sinks for SMTP and Transport Events.
The rest of this article is for those who are currently suffering the same fate of an inability to compile the 2 dll files:
The article on writing managed code was going well, all the way up to point 2 - nmake.exe. After I found a copy of it somewhere, I run it in the ManagedSinksWP directory... it started out compiling the EventInterop ok, with a whole swag of messages like so:
Processing c:\Program Files\Microsoft Platform SDK\Include\mailmsg.idl
Processing c:\Program Files\Microsoft Platform SDK\Include\oaidl.idl
But then trouble struck with a bunch of scary warnings like so:
TlbImp warning: At least one of the arguments for 'IMailMsgProperties.MapContent' can not be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.
TlbImp warning: The type library importer could not convert the signature for the member '_FIO_CONTEXT.m_hFile'.
And finaly bumming out with:
patching file '.\obj\Microsoft.Exchange.Transport.EventInterop.il.orig'
Hunk #5 FAILED at 1011.
Hunk #42 FAILED at 3619.
2 out of 42 hunks FAILED -- saving rejects to file '.\obj\Microsoft.Exchange.Transport.EventInterop.il.rej'
NMAKE : fatal error U1077: 'patch' : return code '0x1'
It did create the EventInterop.dll file in the "obj" directory, but it looked fishy. After several hours (or was it days) of looking for files, programs, settings and directories I finally ended up with this setting:
- Installed the Windows Platform SDK (just the core stuff) - you can get the SDK from the Microsoft site... somewhere.
- Added environment settings: Make sure the environment variables had the Platform SDK and .Net paths for both the includes and the libraries.
- Added a path to tlbimp.exe in the environment variables - C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin and also to ilasm.exe which was in c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
It ran like a charm. It filled me with joy. Here are the files, incase you give up on making your own:
A godsend !!! I have been going through exactly the same pain!!
Many thanks! I was having the same exact problem, especially trying to get this to compile with VS 2005. Behold the power of Google, when a search for “transport.eventinterop.dll” led me to this page. :-)
Okay, so did you ever get your sink to actually DO ANYTHING?
I’m trying to get my sink to work on the default SMTP server shipped with IIS 6.0. Did you deploy against that, or against a full-blown Exchange server? Because smtpreg.vbs only allows me to register for an OnArrival event, and I can’t even get that to fire! And trying to debug by attaching to inetinfo.exe tells me that my symbols aren’t loaded at all, even after registering and restarting IIS. So I’m somewhat baffled.
How did it work for you?
You can reach me at chris dot ambler (at) enom dot com
Many thanks in advance if you have any wisdom to share!
After two weeks searching, i found it :)
Thanks a lot :).