The infopath form template containsCodeTo deploy the program to farm, you need to perform some special steps in the following two methods: code and powershell.
Code Format
Http://nader.elshehabi.com/2011/08/how-to-really-deploy-infopath-2010-forms-with-code-behind-as-a-feature/
Http://sandeepnakarmi.com.np/2011/03/sharepoint-solution-to-deploy-infopath-form-template-as-administrator-approved-form-template/
Powershell format
For ease of use, you can use the following form
DP. bat s installation form
DP. bat a activation form
DP. Bat R Delete form
Modify the name of DP. Bat based on your site and form name. The specific content is as follows:
DP. bat
@ Echo off
Setlocal enabledelayedexpansion
CLS
If "% 1" "=" Goto done
Rem Template Name and site set
Set siteurl = http: // demo
Set formname = work order. xsn
Set formpath = % ~ Dp0 work order. xsn
: Echo % siteurl %
: Echo % formname %
: Echo % formpath %
If % 1 = S (
Install the echo Template
Powershell-command "& {. \ setupform. PS1 % formpath %}"-noexit
)
If % 1 = (
Echo template activates the Origin Site Point Set
Powershell-command "& {. \ activeform. PS1 % siteurl % formname %}"-noexit
)
If % 1 = R (
Echo template Deletion
Delete REM in Management Center View
Rem http: // localhost: 1513/_ admin/manageformtemplates. aspx
Rem http: // localhost: 1513/_ admin/Timer. aspx
Powershell-command "& {. \ removeform. PS1 % siteurl % formname %}"-noexit
)
: Done
Pause
Setupform. PS1
Write-host "Num ARGs:" $ args. length;
# Foreach ($ ARG in $ ARGs)
#{
# Write-host "Arg: $ Arg ";
#}
# $ Siteurl = $ ARGs [0]
$ Form = $ ARGs [0]
# Check to ensure Microsoft. Sharepoint. powershell is loaded
$ Snapin = Get-pssnapin | where-object {$ _. Name-EQ 'Microsoft. Sharepoint. power '}
If ($ snapin-EQ $ null ){
Write-host "loading SharePoint powershell snapin"
Add-pssnapin "Microsoft. Sharepoint. powershell"
}
Test-spinfopathformtemplate-path $ form
Install-spinfopathformtemplate-path $ form
Activeform. PS1
Write-host "Num ARGs:" $ args. length;
# Foreach ($ ARG in $ ARGs)
#{
# Write-host "Arg: $ Arg ";
#}
$ Siteurl = $ ARGs [0]
$ Form = $ ARGs [1]
# Check to ensure Microsoft. Sharepoint. powershell is loaded
$ Snapin = Get-pssnapin | where-object {$ _. Name-EQ 'Microsoft. Sharepoint. power '}
If ($ snapin-EQ $ null ){
Write-host "loading SharePoint powershell snapin"
Add-pssnapin "Microsoft. Sharepoint. powershell"
}
Enable-spinfopathformtemplate-identity $ form-site $ siteurl
Removeform. PS1
Write-host "Num ARGs:" $ args. length;
# Foreach ($ ARG in $ ARGs)
#{
# Write-host "Arg: $ Arg ";
#}
$ Siteurl = $ ARGs [0]
$ Form = $ ARGs [1]
# Check to ensure Microsoft. Sharepoint. powershell is loaded
$ Snapin = Get-pssnapin | where-object {$ _. Name-EQ 'Microsoft. Sharepoint. power '}
If ($ snapin-EQ $ null ){
Write-host "loading SharePoint powershell snapin"
Add-pssnapin "Microsoft. Sharepoint. powershell"
}
disable-spinfopathformtemplate-identity $ form-site $ siteurl
uninstall-spinfopathformtemplate-identity $ form