Sunday, July 8, 2012

Deploy infopath form using PowerShell or STSADM command

Introduction:
In this article we will discuss how to deploy infopath form using PowerShell or STSADM command. You can also check my last article on Introduction to InfoPath form. Also you can check PowerShell command to install and activate features in SharePoint 2010.

Details:

Through STSADM: First we will see how to deploy an InfoPath form using STSADM. STSADM usually located in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\stsadm path.
We have to do it in sequence First we need to deactivate the infopath form like below command:

To Deactivate:
STSADM.EXE -o DeActivateFormTemplate -url http://[URL of Site collection] –filename MyTestInfoPathForm.xsn

Then we need to remove the infopath form template like below:

To Remove:
STSADM.EXE -o RemoveFormTemplate –filename MyTestInfoPathForm.xsn

Then we can Verify the infopath form.

To Verify:
STSADM.EXE -o VerifyFormTemplate -filename MyTestInfoPathForm.xsn

Now we have to Upload the form Template.

To Upload:
STSADM.EXE -o UploadFormTemplate -filename MyTestInfoPathForm.xsn

Now in the final step we need to activate the infopath form template:

To Activate:
STSADM.EXE -o ActivateFormTemplate -url http://[URL of Site collection] –filename MyTestInfoPathForm.xsn

In the next section we will check how to deploy the infopath form template using PowerShell.

Through PowerShell:

The same steps that we followed in the above for STSADM command, we need to follow the exact steps for the PowerShell command also.

To Deactivate:
Disable-SPInfoPathFormTemplate -Identity MyTestInfoPathForm.xsn
Then we need to remove the infopath form template like below:

To Remove:
Uninstall-SPInfoPathFormTemplate -Identity MyTestInfoPathForm.xsn

Then we can Verify the infopath form.
To Verify:
Test-SPInfoPathFormTemplate -Identity MyTestInfoPathForm.xsn

Now we have to Upload the form Template.

To Upload:
Install-SPInfoPathFormTemplate -Path C:\MyTestInfoPathForm.xsn

Now in the final step we need to activate the infopath form template:

To Activate:
Enable-SPInfoPathFormTemplate -Identity "MyTestInfoPathForm.xsn" -Site "http://[URL of Site collection]"

No comments:

Post a Comment