Archive for InfoPath

Debugging InfoPath Browser Form

If you’re using custom code with your browser enabled InfoPath forms and would like to be able to debug them, follow the steps outlined below to configure the form to enable this.

Open the Visual Studio Tool for Applications(VSTA) editor with the code behind for your InfoPath form. In the solution explorer pane, right click your project and select Properties.

Switch to the Build tab and click the Advanced button:

Advanced Button
Read more

Register Code Behind InfoPath Form for Web Browsing

This post describes how to deploy a web browser compatible InfoPath form, with code-behind, through a SharePoint feature.

Installing and registering an InfoPath form, along with a custom content type is pretty straight forward once you know the required steps.

Start by creating a content type that inherits from the Forms type. The following is a sample content type’s markup.

< ?xml version="1.0" encoding="utf-8"?>
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <contenttype ID="0x0101010076AEDEA7CA2A44B59ECB3D491618E052"
        Name="Custom Form CT"
        Group="Custom"
        Inherits="TRUE"
        RequireClientRenderingOnNew="FALSE"
        Version="0">
    <fieldrefs>
    </fieldrefs>
    <documenttemplate TargetName="/FormServerTemplates/CustomForm.xsn"></documenttemplate>
  </contenttype> 
</elements>

Read more

InfoPath Object Reference not set Error

After designing an InfoPath form and as you try to upload and register the form to SharePoint, through the Central Administration site for example, you may see the following error:

Object reference not set to an instance of an object

You may also see the following error when previewing the form within InfoPath Designer:

InfoPath cannot open the selected form. There was an error while loading the XML Schema for the form.

Read more

Form template failed to load

If you’re working with an InfoPath form and are trying to display it as a web enabled form but are getting errors saying the form template failed to load, it may just be due to the manifest for the XSN not containing the relative URL base.

For the following ULS errors:

The form template failed to load. (User: …., Type: NullReferenceException, Exception Message: Object reference not set to an instance of an object.)
and
Unhandled exception when rendering form System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.
UrlIsSameFileOrSamePath(String absoluteFileUrl, String baseFileOrFolderUrl)….

These are due to the XSN not having the base URL defined, which can be resolved by updating the manifest.xml with the following element:
Read more

Package and Deploy a SharePoint Designer Workflow

Note: A sample project containing a simple designer workflow and the code described in this post is available for download here.

Workflows created in SharePoint Designer are good when you want to be able to deploy workflows to your customers and give them the power to add and customise the actions and logic contained within.

You can save the workflow to the Site Assets as a template from Designer and then either import it into your Visual Studio solution as a Reusable Workflow or SharePoint Solution Package. Importing a Reusable Workflow doesn’t give you a workflow that can be edited in Designer and although the Solution Package method gives you this, you need to create a separate feature with activation events to run custom code against the workflows, such as automatically associating the workflows with your lists.

Sometimes it’s good to be in full control of the installation process, if for example you want to log certain events. It’s also good to be able to understand what the generated Solution Package solution is actually doing.

The purpose of this post is to demonstrate how to deploy one or more SharePoint designer workflows, enable for web browser rendering and associate with a list all through custom code tied to the feature activated event of a web feature.
Read more

Follow

Get every new post delivered to your Inbox

Join other followers: