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.
- 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.
- Right click the .xsn file of the form you are going to edit and click “Design”.
- You will be presented with a message saying the form was published in a different location. Ignore this for now and click “OK”.
- Make sure you store your file locally otherwise you stay in read-only-mode.
- 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”.
- 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
- 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.
- 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
- Go to the code by “Tools > Programming > Microsoft Visual Studio Tools for Applications”. Visual Studio will be opened.
- Add the correct code to the output.
- Build your code. Optionally click “Preview” in your code. In the Project Explorer, right click and select “Rebuild”.
- If an error occurs in the code, go to the code behind it, by selecting “Debug > Start Debugging”. Set a breakpoint and start debugging.
- Fix any other errors that might occur, such as a missing namespace.
- When all changes have been made, the form is ready to be published.
- 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.
- Choose the number of options to include.
- 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
- In Infopath, create a published version of the form. Click “File > Publish”.
- Follow the Publishing Wizard. Select “To a SharePoint server without InfoPath Forms Services”.
- Enter the location of your Sharepoint or InfoPath Forms Services site.
- Click “Enable this for, to be filled out by using a browser”.
- Also select the radio button “Administrator-approved” to prepare this form template for an administrator approval.