Hyperlink to file in InfoPath 2003 - InfoPath Dev
in

InfoPath Dev

Hyperlink to file in InfoPath 2003

Last post 09-27-2011 01:42 AM by crim1. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 03-11-2008 07:19 AM

    Hyperlink to file in InfoPath 2003

    Hi,

    I'm trying to create a hyperlink to a file on our server in an InfoPath form, but I can't seem to make it work. The InfoPath form I'm creating is in a shared network folder, and the file I'm trying to link to is in the same shared network folder. Is it possible to do?

    I've tried Microsoft Office help and the MSDN site (although 90% of it is over my head) and can't find an answer. It may not help that I'm using InfoPath 2003, so far it's been less than helpful as I had to do a date calculation and I know nothing about any programming language, ActiveX control, etc - thankfully this site was a great help.

    Basically I'm creating a checklist for employees and want them to be able to just click on a link (or button) that opens an associated file (often a Word doc or pdf) that may explain the question they are answering, or be a workpaper or something that needs to be done.

    I'm sure I've read somewhere that if I use the full network path it would work (which I imagine to be something like "file://MCA_TS1\H:\Forms\document.pdf"), but it doesn't seem to. I've tried changing the form security to full-trust (however I can't work out how to digitally sign the form as required), but still no go. I found somewhere code to program a button to do the job, but I couldn't make this work either.

    No matter what I try, I seem to get one of two results: 1) clicking the link does nothing - no window, no error message, nothing, or 2) an IE window popup saying the server is unreachable or some other generic error message.

    The first file I'm trying to link to has relaxed security settings on it (non-admin users can modify/add/delete/etc, but not take ownership or change attributes), so I doubt this is a problem. Will it become a problem if a file I want to link to has a stricter security setting (basically open only)? Some of the files are "templates" where I have stricter security settings to prevent employees saving alterations unless they save a copy in another location.

    If anyone has any ideas, or even a simple yes it's possible or no it's not, it would be fantastic. If I can't do it I need to think of some other way of doing the checklists.

    Thanks, Adam.
     
     

     

  • 03-11-2008 10:31 AM In reply to

    Re: Hyperlink to file in InfoPath 2003

    This should be doable and I have done this in 2003 forms before. I have saved the path in a field and then used a hyperlink control.

    First I would verify your hyperlink text.

    Can you paste it into your browser and get the document you are after?

    Try creating a hyperlink in a Word Document to test.

    Another test is try linking to google or something to verify that it is just the path.

    Once you have this then your Hyperlink should be able to open the page or document.

  • 03-11-2008 06:15 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Hi Clay,

    Thanks for the quick reply. I've saved the path in a field and then linked a hyperlink control to that field, but still no good. In design mode, when I right-click on the hyperlink and choose to open the hyperlink, I get the error "Access is denied". In preview mode, clicking on the hyperlink just does nothing. The link works in word and IE, plus a similar hyperlink to Google works fine.

    Would making the form fully trusted help? I can't find a way to "install" the form (when I publish it, I'm not given any options to create the install package), and I know very little about digital certificates.

    Thanks,

    Adam 

  • 03-11-2008 10:49 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    So using google in your field works?

    If so then it must be the hyperlink syntax.  It seems to me I remember something that the hyperlink must be a web based one (http://). It could be a security setting in IE but if it opens via the browser then it should be OK.

    The file type link might not work.  You could try a UNC path too \\computer\share

    I think your items may be on a file share rather than a web server or SharePoint.

    If you had a webserver you might be able to create a redirect.

  • 03-17-2008 10:38 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Linking to google did work, however I am now unable to replicate this.

    We've had troubles with IE7 for a while now, when browsing to a number of sites (and always the same site so not a random thing), the page will not load and will instead show a completely white page (no error messages). I am now getting this with all hyperlinks I create in InfoPath - even to Google.

    I now can't replicate the "access denied" error I had previously been getting, so I am not sure if it is now an IE error or problem with the hyperlinks. I am using the path \\server\share\folder\etc\file.doc which works fine if I manually enter it into IE, and works as a hyperlink in word. I'm hoping that somehow the "access is denied" problem has been solved, but replaced by this other "blank page" problem - probably wishfull thinking

    I am in the process of reinstalling IE to hopefully solve the blank page error, but if there are any ideas out there, I would love to hear them.

  • 03-23-2008 12:10 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    It seems the most friendly syntax for a file: URL to a file on a network drive would be something like this:

    file://///server/share/folder/etc/file.doc

    That's five forward slashes after file:, and all the other slashes are forward slashes as well.

    Please give that a try if you have not already resolved the issue.
     

     

    As for your original post, you mentioned this URL: "file://MCA_TS1\H:\Forms\document.pdf"

    I may be mistaken, but I didn't think that shared drives could have colons in their names.  Could it be the case that MCA_TS1's H: drive has a name other than H: on the network?
     

  • 03-24-2008 08:32 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Hi jrishe,

    Thanks for the tip on five forward slashes, it works while I'm in design mode, but not preview mode now - which is closer than I've been yet!

    My bad on the original path, I now have file://///mca-ts1/share/folder/file.doc, and as mentioned above, in design mode when I right-click on it the file will open, but in preview mode nothing happens. No window pops up, no error messages.

    Any ideas on what is causing this?

    When logged in as myself (a non-administrator), I get a access to resourse denied error. When logged in as the administrator I don't get that error, but I still have the same problem when logged in as administrator with the hyperlink not opening anything in preview mode.

     

  • 03-25-2008 10:07 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Hello again,

     I'm glad that my information helped a little, but unfortunately it may lead to a dead end.  I'm very new to InfoPath myself and am afraid I can't be a lot of help.

    After your most recent post, I toyed around with hyperlinks in InfoPath myself, and had basically the same results as you, even when the file: paths indicated a file on a local drive.

     This is only a guess, but it seems InfoPath might be set to only open links of certain types (http:, mailto:, etc.) and not file: links.  I also noticed that http: links are opened in Internet Explorer and sent to port 80 even when IE is not the default browser and a port is not specified.  So it's doing more than simply carrying out Windows' default behavior for the various addresses.  There might be a way to finagle what you want to do, but it seems to be not as simple as just using a hyperlink control.

     As Clay said above, the simplest solution might be to set up a simple HTTP server on mca-ts1 and make the shared folder accessible that way.  Is that an option?
     

  • 03-31-2008 03:55 PM In reply to

    • Goner
    • Not Ranked
    • Joined on 03-31-2008
    • Posts 1

    Re: Hyperlink to file in InfoPath 2003

    Hi,

     I was able to get this to work on network drive by using the syntax file://mappeddrive/folder/file (eg file://x:/shared/test.doc)

    No success on pulling from local HD though.  Still working on it.

  • 04-06-2008 12:52 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

     Hello,

     Did you ever resolve this issue?  I just figured out there is a rather simple solution if you are willing to use a button instead of a hyperlink and add a small bit of code.  Add a button to the form, and in its properties, click Edit Form Code...

     Then add the following code (I'm providing versions for two different languages):

    (VisualBasic)

    Diagnostics.Process.Start("\\mca-ts1\share\folder\file.doc")

     

    (Visual C#)

    System.Diagnostics.Process.Start(@"\\mca-ts1\share\folder\file.doc");

     

    The path in quotes should be the usual path you would use within Windows.

    It seems the form needs to be set to full trust and may need a certificate, so you might run into some security snags, but that should provide the desired functionality.
     

  • 07-22-2008 01:38 AM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Hi,

    My problem is somewhat like the discussed issue. In my case,in Infopath 2007 link is working fine but the excel file on that link (of type excel 2007) opens in the minimized mode not in the normal mode. Can you tell me what could be the possible reason for this or some work around to avoid that?

    I will be very thankful.

    Akash Kansal.

    Filed under: ,
  • 09-21-2011 03:31 PM In reply to

    Re: Hyperlink to file in InfoPath 2003

    Do you know how to accomplish this using JScript?

  • 09-27-2011 01:42 AM In reply to

    • crim1
    • Not Ranked
    • Joined on 07-07-2010
    • Posts 4

    Re: Hyperlink to file in InfoPath 2003

    In full trust mode you should be able to do something like this:

     var WshShell = new ActiveXObject("WScript.Shell");

    try{

                    WshShell.Run("\\\\SERVER\\SHARE");

    }catch(e){

                  XDocument.UI.Alert(e);

    }

     

     

Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.