C# Set button to open Hyperlink - InfoPath Dev
in

InfoPath Dev

C# Set button to open Hyperlink

Last post 03-07-2013 03:04 PM by zero6972102. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-04-2013 07:09 AM

    C# Set button to open Hyperlink

    I am wondering if there is some C# code that will allow a button control to open a hyperlink. Currently, I am working around this by making the button, taking a snip of it, pasting the image, and adding a hyperlink to the image of the button. Is there a piece of code where I could open hyperlinks such as: ex. "http://(SharePoint Server address)/Shared Documents/Document.docx"
  • 03-07-2013 09:52 AM In reply to

    Re: C# Set button to open Hyperlink

     Is this in a browser form? Or in InfoPath Filler? For Filler - Process.Start("http://myurlhere"); should do what you need.

    Hilary Stoupa

  • 03-07-2013 10:14 AM In reply to

    Re: C# Set button to open Hyperlink

    It is an Infopath Filler Form, not the browser form. I clicked the button and selected Custom Code from the top bar. Where it said "Write your code here", I deleted that sentence and typed what you stated. I then got an error when I tried to click the button: System.Security.SecurityException Request failed. at (Name of my form).FormCode.CTRL55_7_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent) any ideas?
  • 03-07-2013 12:59 PM In reply to

    Re: C# Set button to open Hyperlink

     Whoops - sorry - that code will require you set your form to full trust. You can do that under form options but it means you'll have to sign it or have users install it....

    Hilary Stoupa

  • 03-07-2013 01:02 PM In reply to

    Re: C# Set button to open Hyperlink

    Is there a down side to making it full trust?
  • 03-07-2013 02:17 PM In reply to

    Re: C# Set button to open Hyperlink

     Well- if it is full trust, you either have to sign with a code signing certificate (that your users have to accept) or create an .msi or use a script to install the form on each user's machine. If you don't sign with a code cert and are counting on your users to update their locally installed form any time you make a change.... Well. We know how that will work out. :)

    Hilary Stoupa

  • 03-07-2013 02:35 PM In reply to

    Re: C# Set button to open Hyperlink

    I went into the advanced form options and added my certificate that is signed with a pin, but I'm still getting the same error. Should I be using System.Diagnostics.Process.Start? This is what Visual Studio changed it to automatically when I entered Process.Start
  • 03-07-2013 02:51 PM In reply to

    Re: C# Set button to open Hyperlink

    Did you just sign it? Or did you also set the trust level to full trust? Yes, it is System.Diagnostics.Process.Start.

    Hilary Stoupa

  • 03-07-2013 03:04 PM In reply to

    Re: C# Set button to open Hyperlink

    That is what I missed. Always the simple things. :P Thanks for your help!
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.