I found a post of yours from a few years ago and I’m trying to do exactly what you describe. Wondering if you ever found a way to do this that you could share?
there is more to this fun infopath story.
web form that has an attachment control.
when a user attaches a document, code behind moves it to a document library.
after the document is moved, the attachment control is cleared.
then populate a hyperlink with the description and path to the document, that now lives in the doc library.
hence my move to populate the field with code.
Thank you so much!
In the attached zip file you will find an example of the process. Open the InfoPath form, click the Developer tab, then click Code Editor. You will want to browse to the needed file in the InfoPathAttachmentEncoding folder. If you hit a compile error, you will need to reference the SharePoint dll file and SharePoint.Security dll file.
You can take this to the next level by hiding the attachment control once it’s populated.
Or auto upload to a library once the attachment control is populated.
Keep in mind, if you get to the point where you auto upload to a library, you will need a timer job or something to cleanup orphaned documents.
Your email address will not be published. Required fields are marked *