开发者

Attaching files to an already open mail through VB.Net

开发者 https://www.devze.com 2023-02-04 01:43 出处:网络
I have a problem. I already have an outlook new mail message open. I need to programmatically attach f开发者_开发技巧iles to the e-mail which is already open using vb.net. This is for a windows applic

I have a problem. I already have an outlook new mail message open. I need to programmatically attach f开发者_开发技巧iles to the e-mail which is already open using vb.net. This is for a windows application. How could i do it? any ideas? please help!


The article here sounds specific to Outlook 2007 and VBA/Visual Basic, but is equally applicable to any Windows Application that wants to automate Outlook:

Automating Outlook from a Visual Basic Application [Outlook 2007 Developer Reference]: http://msdn.microsoft.com/en-us/library/bb206737(office.12).aspx

Keep in mind the Caution disclaimer at the bottom over this "non-trusted" approach.

Once you're "in", you get get a handle to the active item via Application.ActiveInspector.CurrentItem. Then use MailItem.Attachments.Add.

You also need to keep this in mind:

Application Shutdown Changes in Outlook 2007 SP2: http://msdn.microsoft.com/en-us/library/dd239276(office.12).aspx#ol2007AppLifecycle_ImpactforSolutions

0

精彩评论

暂无评论...
验证码 换一张
取 消