Tag Archives: Microsoft Visual Studio

How to make a change to an InfoPath form

Lately I have been fiddling around a bit with Sharepoint and in particular InfoPath. In this post I will describe the process of making a change to an Microsoft Office InfoPath 2007 form. What you will need is Microsoft SharePoint Designer 2007. Extra software needed is Microsoft Visual Studio Tools for Applications if you want to make code changes.


  1. Create a local copy of the form you are going to work in. Take the form from your sources folder and also include the corresponding project from the sources\projects subfolder.
  2. Right click the .xsn file of the form you are going to edit and click “Design”.
  3. You will be presented with a message saying the form was published in a different location. Ignore this for now and click “OK”.
  4. Make sure you store your file locally otherwise you stay in read-only-mode.
  5. Make sure the path to the source code is correct. Go to “Tools > Form Options > Programming”. In the bottom field (Project location for Visual Basic and C# code), browse to the location of your source code. Double click on the correct csproj file and click “OK”.
  6. Optionally, if you want secure access to the form, you have to make sure the correct certificate is used to sign the form. If the certificate is not selected, click select certificate and choose the corresponding one. Select the required security level. You need to have the certificate file installed in your machine to be able to do this.

Making an InfoPath change

  1. In case you need to add a new field, or make amendments to the form, find the view in the “Design Tasks”, by clicking “Views”. Then, find the field name in the corresponding view or go to the view where the additional field(s) need to be created.
  2. Go to “Design Tasks > Data Source” and find the field name or the proper group of fields. Hovering the field name will show you the data type as well as the default value.

Making a code change

  1. Go to the code by “Tools > Programming > Microsoft Visual Studio Tools for Applications”. Visual Studio will be opened.
  2. Add the correct code to the output.
  3. Build your code. Optionally click “Preview” in your code. In the Project Explorer, right click and select “Rebuild”.
  4. If an error occurs in the code, go to the code behind it, by selecting “Debug > Start Debugging”. Set a breakpoint and start debugging.
  5. Fix any other errors that might occur, such as a missing namespace.
  6. When all changes have been made, the form is ready to be published.

Adding controls

  1. In the design view, right click in the form and select “Insert >Rows” or “Insert  > Columns”. For more controls, click “Insert > More controls…”.  Standard controls include text box, drop-down list box, date picker, option button, button et cetera. You can also add file attachments and hyperlinks for instance. Let’s choose an Option Button here.
  2. Choose the number of options to include.
  3. Set correct labels and double click on the radio buttons to set the correct name for the field as well as the value of the field when this option is chosen.

Publishing the form to a SharePoint server

  1. In Infopath, create a published version of the form. Click “File > Publish”.
  2. Follow the Publishing Wizard.  Select “To a SharePoint server without InfoPath Forms Services”.
  3. Enter the location of your Sharepoint or InfoPath Forms Services site.
  4. Click “Enable this for, to be filled out by using a browser”.
  5. Also select the radio button “Administrator-approved” to prepare this form template for an administrator approval.