1: 验证stsadm –o verifyformtemplate –filename <Path"FileName>
2:上传 stsadm –o uploadformtemplate –filename <Path"FileName>
3:激活 stsadm -o activateformtemplate -url <URL to the site collection> [-formid <form template ID>] [-filename <path to form template file>]
4:反激活 stsadm -o deactivateformtemplate -url <URL to the site collection> [-formid <form template ID>] [-filename <path to form template file>]
5:更新stsadm -o upgradeformtemplate -filename <path to form template file> [-upgradetype <upgrade type>]
更新要注意的是,不能是相对路径,必须的是绝对路径哦。
6:删除
stsadm -o removeformtemplate [-formid <form template ID>] [-filename <path to form template file>]
如果写成bat文件:
@rem
@rem setup.bat
@rem
@rem======================================================================
@echo off
setlocal
pushd .
goto LInitialize
@rem----------------------------------------------------------------------
@rem LInitialize
@rem----------------------------------------------------------------------
:LInitialize
set SPAdminTool=%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe
set Install=
set Uninstall=
set PackageFile=%~dp0publich\InfopathInstall.xsn
set PackageName=InfopathInstall.xsn
set DefaultWebUrl=http://moss:8899
set DefaultSiteUrl=http://moss:8899
set fileAdress=D:\chenhl\InfopathInstall\publich\InfopathInstall.xsn
set TargetSiteUrl=
goto LParseArgs
@rem----------------------------------------------------------------------
@rem LParseArgs
@rem----------------------------------------------------------------------
:LParseArgs
@rem --- help ---
if "%1" == "/?" goto LHelp
if "%1" == "-?" goto LHelp
if "%1" == "/h" goto LHelp
if "%1" == "-h" goto LHelp
if "%1" == "/help" goto LHelp
if "%1" == "-help" goto LHelp
@rem --- Fix execute task ---
if "%1" == "/i" (set Install=1) & shift & goto LParseArgs
if "%1" == "-i" (set Install=1) & shift & goto LParseArgs
if "%1" == "/install" (set Install=1) & shift & goto LParseArgs
if "%1" == "-install" (set Install=1) & shift & goto LParseArgs
if "%1" == "/u" (set Uninstall=1) & shift & goto LParseArgs
if "%1" == "-u" (set Uninstall=1) & shift & goto LParseArgs
if "%1" == "/uninstall" (set Uninstall=1) & shift & goto LParseArgs
if "%1" == "-uninstall" (set Uninstall=1) & shift & goto LParseArgs
@rem --- Fix url ---
if "%1" == "/weburl" (set TargetWebUrl=%2) & shift & shift & goto LParseArgs
if "%1" == "-weburl" (set TargetWebUrl=%2) & shift & shift & goto LParseArgs
if "%1" == "/siteurl" (set TargetSiteUrl=%2) & shift & shift & goto LParseArgs
if "%1" == "-siteurl" (set TargetSiteUrl=%2) & shift & shift & goto LParseArgs
@rem --- Check invalid arguments ---
if not "%1" == "" (
echo Invalid argument.
goto LHelp
)
@rem --- Check arguments ---
if "%Install%" == "1" (
if "%Uninstall%" == "1" (
goto LHelp
)
)
if "%Install%" == "" (
if "%Uninstall%" == "" (
set Install=1
)
)
if "%TargetSiteUrl%" == "" (
if "%TargetWebUrl%" == "" (
set TargetWebUrl=%DefaultWebUrl%
set TargetSiteUrl=%DefaultSiteUrl%
)
if not "%TargetWebUrl%" == "" (
set TargetSiteUrl=%TargetWebUrl%
echo Setting TargetSiteUrl to be %TargetWebUrl%
)
)
if "%TargetWebUrl%" == "" (
set TargetWebUrl=%TargetSiteUrl%
echo Setting TargetWebUrl to be %TargetSiteUrl%
)
goto LMain
@rem----------------------------------------------------------------------
@rem LHelp
@rem----------------------------------------------------------------------
:LHelp
echo Usage:
echo setup.bat [/install or /uninstall][/weburl ^ < url ^ > ][/siteurl ^ < url ^ > ]
echo [/help]
echo.
echo Options:
echo /install or /uninstall
echo Install specified Solution package (.wsp) to the SharePoint server
echo or uninstall specified Solution from the SharePoint server.
echo Default value: install
echo /weburl
echo Specify a web url of the SharePoint server.
echo Default value: %DefaultWebUrl%
echo /siteurl
echo Specify a site url of the SharePoint server.
echo Default value: %DefaultSiteUrl%
echo /help
echo Show this information.
echo.
goto LTerminate
@rem----------------------------------------------------------------------
@rem LMain
@rem----------------------------------------------------------------------
:LMain
if "%Install%" == "1" (
call :LDeploy
)
if "%Uninstall%" == "1" (
call :LRetract
)
goto LTerminate
@rem----------------------------------------------------------------------
@rem LDeploy
@rem----------------------------------------------------------------------
:LDeploy
echo Deploying form template %PackageName% to the SharePoint
"%SPAdminTool%" -o verifyformtemplate -filename "%PackageFile%"
echo uploading form template %PackageName%
"%SPAdminTool%" -o uploadformtemplate -filename "%PackageName%"
echo Activating form template %PackageName%
stsadm -o activateformtemplate -url %DefaultSiteUrl% -filename "%fileAdress%"
goto :EOF
@rem----------------------------------------------------------------------
@rem LRetract
@rem----------------------------------------------------------------------
:LRetract
echo remove form template %PackageName%
"%SPAdminTool%" -o removeformtemplate -filename D:\chenhl\InfopathInstall\publich\InfopathInstall.xsn
goto :EOF
@rem----------------------------------------------------------------------
@rem LTerminate
@rem----------------------------------------------------------------------
:LTerminate
set UserInput=
set /P UserInput=Hit enter key to quit.
set SPAdminTool=
set PackageFile=
set PackageName=
set Install=
set Uninstall=
set TargetSiteUrl=
set TargetWebUrl=
set UserInput=
popd
endlocal
直接执行就ok了。