Link to home
Start Free TrialLog in
Avatar of kbessent1966
kbessent1966

asked on

How can I programmatically add a file attachment to an InfoPath form using VB.Net?

Would anyone know how to add a file from disk to a InfoPath 2007 form as a
file attachment using VB.net code? The following link has a c# example but I
can not get this to work.
http://www.cubido.at/Blog/tabid/176/EntryID/44/Default.aspx

Thanks
Avatar of Clay Fox
Clay Fox
Flag of United States of America image

You want to have a file automatically attached or you do not want to have the user browse for it?

I have done a seperate attach process to automatically take an email attachment and inject it into a form before.

Give me a bit more details of what you are trying to do.
Avatar of kbessent1966
kbessent1966

ASKER

Hi Clay,

Thanks for your response, I need to inject a PDF file into the form as an attachment. The PDF file is located on the local PC hard drive. Therefore, the user will not browse for it, the user clicks a button within the form, then the vb.net code collects the C:\test.pdf file, encodes to base64, assigns header info etc. The user then can open the PDF from the InfoPath form via a standard attachment control (right click open).

Hope this clears things up.
ASKER CERTIFIED SOLUTION
Avatar of Clay Fox
Clay Fox
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Clay, I have emailed you directly about obtaining the source code for this problem, when you have chance, could you please email a copy to me at kb@donovanhill.com.au
Thanks Kevin Bessent.