Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've got an Infopath form with a file attachment control. Everything works great, files are being attached. For a while, we've been all unicorns and rainbows.

Users were happy, except now, with the frequency of forms with attachments increasing, they are starting to voice complaints.

Here's the deal:

When you click on the control, Infopath gives you three options:

  • Attach
  • Download
  • Remove

In order to view the attachment, you need to first download the file, then open it from explorer. Users are claiming this is an inconvenience. What they would like to do is have the ability to automatically view the file in a way that's similar to what you are able to do when downloading a file within IE (you know: run, save, cancel).

Is there any way to "run" an attached file directly from an Infopath form?

Thanks for any assistance you can offer.

BoB.

share|improve this question

closed as off topic by Alex Angas May 11 '11 at 2:33

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
If I had mentioned that my forms are stored in document library and users only access the form via a browser in a SP 2010 site, would that have made this post "generally relate to SharePoint"? –  BoB May 11 '11 at 4:36
    
Maybe no need so much option. Just let the end user able to view the attachment on the infopath form rather than as a link. –  Larry Morries Nov 22 '11 at 7:42
add comment

1 Answer 1

up vote 0 down vote accepted

No {;<

Attachments in InfoPath are embedded into the XML as Base64 encoded strings, so supporting this would require a post-back to the server to extract the file and the output to the browser stream as a file.

I have solved this problem in the past by replacing the attachment with a hyperlink to a custom layouts page that takes the unique id of the form (or the path) as a parameter, located the file on the server, extracted the file, and then rendered out as a file.

Here is a blog post on how to extract an attachment from InfoPath:

http://blah.winsmarts.com/2008-8-InfoPath_2007_-_Extracting_those_pesky_Binary_attachments.aspx

share|improve this answer
    
Thanks Chris. I'll look into that. –  BoB May 11 '11 at 4:34
    
Hi Chris, you have any solution using just JavaScript or from the InfoPath itself? (without the need to use VSTA) –  Larry Morries Dec 28 '11 at 2:19
    
Sorry Larry, if it could be done it would be a complete hack. InfoPath does render into the browser as HTML with a JavaScript library provided by InfoPath Form Services. The JavaScript files are in the SharePoint 14 hive. I suppose it might be possible to do some reverse engineering in that JavaScript file, use the InfoPath WebPart to render into a page with your own JavaScript libraries and possibly rig up something. Like I said, it would be a hack, and not something I have tried before. –  Chris Beckett Jan 6 '12 at 23:51
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.