Monday, August 28, 2006

InfoPath 2007 – solving XSN can not be used on server


With Microsoft Office SharePoint Server 2007 it is possible to use InfoPath forms to get feedback from users within a workflow A good starting point is the white paper – Walkthrough : Creating Office SharePoint Server 2007 workflows with Visual Studio but there are still some things you should really now before starting developing your own workflows on top of the SharePoint 2007 platform. This is the first of a series of postings about workflow in SharePoint 2007.

InfoPath 2007 is used in a couple of places in a SharePoint driven workflow:

When you want to develop a SharePoint workflow with Visual Studio 2005 you will first need to install the SharePoint workflow project templates. These Visual Studio project templates are installed when you install either the ECM Starter Kit (for Microsoft Office SharePoint Server ) or the Workflow Developer Starter Kit for Windows SharePoint Services 3.0.

When you start a new SharePoint workflow project, you will notice that the solution contains a number of files which are used to define the workflow solution – one of them is the workflow.xml file. In this file, you will need to specify the InfoPath forms you will be using by specifying the URNs. To find the URN of an InfoPath form, open the form in InfoPath in design mode and choose properties from the file menu.

<MetaData>

<Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:initform:-myXSD-2006-08-09T08-38-04</Instantiation_FormURN>

<Association_FormURN>urn:schemas-microsoft-com:office:infopath:initform:-myXSD-2006-08-09T08-38-04</Association_FormURN>

<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:TaskEdit:-myXSD-2006-08-09T11-19-01</Task0_FormURN>

</MetaData>


Another location where you can find a reference to the InfoPath forms is in the feature.xml file – here you see the next section – make sure that you uncomment the <Property Key=”RegisterForms” Value=”*.xsn” /> line – this specifies that you will copy the InfoPath forms to the same directory as where you deploy the feature.xml file.

<Property Key="GloballyAvailable" Value="true" />

<Property Key="RegisterForms" Value="*.xsn" />

</Properties>


The last file that you need take a look at is install.bat - this will register your workflow solution, copy the necessary files and register the workflow assembly in the GAC.

Things you should watch out for:

  • Design the InfoPath files in a directory separate from your solution and publish them to the same directory (Use publish to network location) in which you have your workflow solution – this way you can simply use the <Property Key=”RegisterForms” Value=”*xsn” /> and use the default line in install.bat - xcopy /s /Y *.xsn "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\YourCustomFeature\"
  • Make sure that the Alternate access path is not filled in when publishing the InfoPath files – when publishing it to a network location, you should have received a warning – see screenshot listed below.



If something goes wrong, one of them the infamous “XSN can not be used on the server” error, you can troubleshoot the problem with the following steps:

  • Navigate to a command prompt
  • Navigate to this folder: %programfiles%\common files\microsoft shared\web server extensions\12\bin
  • Execute this command on each of your XSN files: stsadm.exe -o verifyformtemplate -filename <complete path to your xsn including the name.xsn>

This will give a more detailed description - if you are not sure if the access path is filled in for the InfoPath form you have deployed – you can rename the xsn file in the features directory to a CAB file and extract manifest.xsf from this file in this file – you should see that accessPath=""


P.S. For some more tips, take a look at Blood, sweat and Windows Workflow in SharePoint

4 comments:

  1. Anonymous4:39 PM

    Thanks for the link, it's nice to know that what I've learnt might spare others the pain. Unfortunately, that site will be gone in a week or so - the new address for 'Blood, sweat and tears in Windows Workflow' will be http://www.novolocus.com/display.php?id=267

    ReplyDelete
  2. Anonymous5:00 PM

    The non-empty accessPath was my problem. Thanks!

    ReplyDelete
  3. Burak Donbay10:27 PM

    Thanks..

    ReplyDelete
  4. Anonymous8:58 AM

    thanks for the article.. helped me to come out of this prolonged problem..

    ReplyDelete