How to deploy infopath forms to farm

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.