InfoPath: How do I show local path of attached file instead of attaching the physical file

Posted on 2014-08-06
Last Modified: 2014-09-23
When using the file attachment control in a 2007 InfoPath form, I want to display the local path where the file was attached instead of attaching the actual file itself.  The path could be a network location, shared drive, etc. and we'd like the path to be 'clickable'.

I've looked around and found ways to get the filename but it doesn't say how to get the entire local file path.  I'm assuming I have to use the file control because we want the browse capability.
Question by:skipper68
    LVL 3

    Expert Comment

    by:Brenda D
    You can create an Hyperlink link from the control panel and enter the path to the file.  enter the Drive letter and then the filename. I.e. H:\12345.docx.

    When the user clicks on the hyperlink it will open the file up from that location.
    LVL 9

    Accepted Solution

    Thanks Brenda but I had thought this question was deleted due to no responses.  Anyway, here's how I did it for anyone who is having the same problem:
    I had to create a button that utilized form code which allowed you to trap the file selection window and get the path of the file which I ultimately put in a URL formatted text box:
    AddHandler DirectCast(EventManager.ControlEvents("CTRL77_5"), ButtonEvent).Clicked, AddressOf CTRL77_5_Clicked
    Public Sub CTRL77_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
                Dim OFD As OpenFileDialog = New System.Windows.Forms.OpenFileDialog
                OFD.Title = "Select A File"
                If OFD.ShowDialog() = DialogResult.OK Then
                    Dim sr As New System.IO.StreamReader(OFD.FileName)
                    Dim nav As XPathNavigator = MainDataSource.CreateNavigator
                    nav.SelectSingleNode("/my:myFields/my:field7", NamespaceManager).SetValue(OFD.FileName)
                End If
    End Sub

    Open in new window

    This however raised another issue because it was a server side form which was trying to access local resources.  That meant I had to use a Code Signing Certificate to sign the form which was an entirely different issue. :-)
    LVL 3

    Expert Comment

    by:Brenda D
    excellent job on the coding. thank you for the update.
    LVL 9

    Author Closing Comment

    See my solution above.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Before you can digitally sign infopath forms, you must have a digital certificate. Microsoft Certificate Services will need to be enabled on a Windows Server 2008 to facilitate the creation and verification of the digital certifciates on the web ser…
    Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now