Sierra Bravo Corp
On This Page
Html Agility Pack
Visual Studio 2010
Visual Studio Extensions
Scott Guthrie (msft)
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way
Copyright © 2013
This work by
is, unless explicitly stated in the article, available under the
Creative Commons Attribution 3.0 United States License
Pick a theme:
Discreet Blog Blue
Movable Radio Blue
Movable Radio Heat
Thursday, October 23, 2008
Deprecation of API's and Native Calls
- Thursday, October 23, 2008 8:15:23 PM (Central Standard Time, UTC-06:00)
The other day I was posed with a problem to implement a "Send as Attachment" feature to an existing application. I thought, well this should be easy I've seen many other do it before. I quoted the work at a few hours, figuring some quick searching would give my my answers. I was wrong.
Sending an email using the default email client is very easy with the mailto: protocol. The problem lies in adding an attachment. Common mail programs like Outlook and Thunderbird do not support the attachment option. So, I started looking at MAPI the native API for doing this. I could not find any .NET wrappers. I did find that there were controls created by MS for VB6. Most of the .NET examples I found used COM interop with the ActiveX controls. But after trying these controls (which look like they were last updated in 98) I found them to not work in XP SP3. I'd get random exceptions and was never able to actually get an email dialog to pop up.
After failing with the ActiveX controls I was out of time. The MAPI native commands may have worked but it would take too long to set up the native calls and test it. After discussing with the client we ended up coming up with a bit hackish but workable solution. I would use the mailto: protocol and then launch explorer with the attachment selected. To them this is a minor annoyance that is acceptable. To me this an unfortunate sign of the times.
Things that were once "easy" for native applications become complicated and buggy for managed. It seems too often that I must make use native calls or old unsuported COM objects to get the job done. While MS has done a great job building up the .NET Framework. It seems that many native API's still remain unwrapped. Furthermore some places I read that the MAPI api is unstable on Vista. It seems that some API's are slipping through the cracks.
All comments require the approval of the site owner before being displayed.
(will show your
Comment (Some html is allowed:
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u
) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.
Enter the code shown (prevents robots):
Live Comment Preview