http://blah.winsmarts.com/2008-8-Deploying%5FInfoPath%5F2007%5FForms%5Fto%5FForms%5FServer%5F-and-ndash%5FProperly.aspx
1: <?xml version=”1.0″ encoding=”utf-8″ ?>
2: <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
3: Id="41CEE181-9440-4536-A1DA-73F41D2155B7"
4: Title="My Form"
5: Description="This feature deploys the browser enabled InfoPath Form."
6: Version="12.0.0.0"
7: Scope="Site"
8: DefaultResourceFile="ipfscore"
9: ReceiverClass="Microsoft.Office.InfoPath.Server.Administration.XsnFeatureReceiver"
10: ReceiverAssembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" >
11: <ActivationDependencies>
12: <ActivationDependency FeatureId="C88C4FF1-DBF5-4649-AD9F-C6C426EBCBF5"/>
13: </ActivationDependencies>
14: <ElementManifests>
15: <ElementManifest Location="element.xml"/>
16: <ElementFile Location="MyForm.xsn"/>
17: </ElementManifests>
18: <Properties>
19: <Property Key="FeatureName" Value="My InfoPath Form Template Feature"/>
20: </Properties>
21: </Feature>
1: <?xml version="1.0" encoding="utf-8" ?>
2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
3: <Module Name="XSN" Url="FormServerTemplates" RootWebOnly="TRUE">
4: <File Url="MyForm.xsn" Name="MyForm.xsn" Type="GhostableInLibrary"/>
5: </Module>
6: </Elements>
Microsoft.Office.InfoPath.Server.Administration.XsnFeatureReceiver
http://blogs.infosupport.com/blogs/porint/archive/2007/04/24/How-to-deploy-an-admin-approved-form-template-using-the-feature-framework.aspx
Background to the Infopath form solution. By downloading the solution from the farm config store.
http://creativesharepoint.posterous.com/solution-packaging-infopath-forms-for-sharepo
Focus on how to deploy with UDCX connections and code-behind DLL.InfoPath Data Connections
If your form needs to use any external data connection files (.udcx files), go through these steps to make sure the deployed InfoPath form will look for the external data connection file in the Central Administration site that it is uploaded to. The point of this is so that you don’t have to reconfigure paths in the InfoPath form and re-publish every time you want to deploy to a different SharePoint farm. You will still need to create a new .udcx file and upload it to the Central Administration on the new farm, but that's a lot easier than the alternative!
- Convert Any Non-External Data Connections to External Data Connections (.udcx files) and upload them to a data connections library
- In InfoPath Designer, click “Tools” > “Data Connections”
- Select the data connection and click “Convert…”
- Enter the URL of any SharePoint Data Connections library that you have contribute access to (don’t worry, this won’t be the final resting place of the .udcx file)
- Select “Centrally managed connection library (advanced)” and click “OK”
- For any existing External Data Connections, check to make sure they are set to be centrally managed
- In InfoPath Designer, click “Tools” > “Data Connections”
- Select the data connection and click “Modify…”
- Click “Connection Options…”
- Select “Centrally managed connection library” and click “OK”
- Click “Next >” through the rest of the options and finally “Finish”
- Download, update, and upload the External Data Connection files to Central Administration
- Browse to the Data Connections library that you uploaded the External Data Connection files to from step 1.
- Click the drop down next to the name and select “Send To” > “Download a Copy”
- Open the .udcx file in your favorite text editor (let’s hear it for Emacs!) and make modifications.
- Set the “UseFormsServiceProxy” attribute to “true” wherever it is set to “false”
- Change any web service URLs to the appropriate URLs (think development, staging, or production environments)
- Browse to the Central Administration of the SharePoint farm you are going to deploy this InfoPath form to.
- Click “Application Management” then under the “InfoPath Forms Services” section click “Manage data connection files”
- Click upload
InfoPath Deployment
- If the form is not already there, copy the InfoPath form into the root of the solution. Your solution should now look like figure 2 at the bottom of this post.
- Open the InfoPath form in InfoPath Designer
- Publish the Form
- Select “File” > “Publish”
- Select “To a network location” for where you want to publish the form template and click “Next”
- For the path, navigate to the TEMPLATE\FEATURES\InfoPathFormFeatures folder in your solution.
- Enter the “Form template name” and click “Next”
- On this screen, clear out any text in the text box and click “Next”. It is possible that a prompt might appear stating: “Users will not be able to open this form because of the security level it requires and because no alternative access path has been specified. To enable users to open the form, you must enter an alternative access path. Click OK, to continue publishing the form template or Cancel to enter an alternative access path." This form can be safely ignored, since when this form is published to Central Admin, the correct permission level will be automatically assigned.
- Click “Publish”
- Click “Close”
- Add the published form to the feature folder in your Visual Studio Project
- Right Click on the feature folder and click “Add” > “Existing Item…”
- Select the published InfoPath form and click “Add”
InfoPath Code Behind
If your InfoPath form has .Net code behind, run through these steps. On a side note, as far as I know, InfoPath 2007 form code behind is automatically created in Visual Studio 2005. So if you were previously using Visual Studio 2008 like I am, you might just skip step 1 and manually add the project to your source control. (You are using source control right?)
- Add the Visual Studio project for the form code behind to this solution for easy reference
- Click “File” > “Add” > “Existing Project…”
- Select the .csproj file for the InfoPath form code behind and click “Open”
- Add the code behind .dll to the Feature folder
According to this post, an error is thrown if you don’t deploy the code behind .dll in the feature folder (yes, even if it is already deployed in the GAC. I haven’t seen this first hand, but hey, I’m a trusting guy!)
-
I created a file called WSP.ddf in the root of the project. This will be used to create a solution package to deploy and InfoPath Feature.
I then finally added a manifest.xml file to the project.
In the properties of the project, in the Post Build Events, I added the following which will create my deployment package when the project is built:
cd $(ProjectDir)
MakeCAB /D outputDir=$(OutDir) /f "WSP.ddf"