深入浅出InfoPath——让管理员来部署InfoPath表单
應用場景:
我們(乙方)在給客戶提供基于InfoPath表單(尤其是包含托管代碼的)的工作流解決方案的時候,常常需要客戶(甲方)的SharePoint管理員來幫忙在安裝SharePoint Server的服務器上部署,而管理員不需要知道需要哪些步驟來完成InfoPath Service的部署,更不愿意看到通過繁瑣的操作來完成預定的任務。大家都知道企業軟件有個特點:盡可能少的Code。要想問題少的最好辦法就使用盡可能少的代碼。所以我們使用命令來部署InfoPath Service自動化部署InfoPath表單是最好的辦法。
基本原理:
使用bat命令或者PowerShell來執行SharePoint管理命令。SharePoint為管理員提供了以下部署InfoPath表單的命令:
%STSADM% -o RemoveFormTemplate -filename
%STSADM% -o uploadformtemplate -filename
%STSADM% -o deactivateformtemplate -url %SITEURL% -filename
%STSADM% -o activateformtemplate -url %SITEURL% -filename
參考方案:
我們現在需要客戶的SharePoint管理員來重新部署我們提供的出差申請流程。
1 文件結構如下放置
2 bat腳本
@SET STSADM="%programfiles%\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE"@SET SITEURL="https://www.cnblogs.com/sites/mingle"
%STSADM% -o RemoveFormTemplate -filename "Mingle.FormTemplates\BusinessTripRequest.xsn"
%STSADM% -o execadmsvcjobs
%STSADM% -o uploadformtemplate -filename "Mingle.FormTemplates\BusinessTripRequest.xsn"
%STSADM% -o execadmsvcjobs
%STSADM% -o deactivateformtemplate -url %SITEURL% -filename "Mingle.FormTemplates\BusinessTripRequest.xsn"
%STSADM% -o execadmsvcjobs
%STSADM% -o activateformtemplate -url %SITEURL% -filename "Mingle.FormTemplates\BusinessTripRequest.xsn"
%STSADM% -o execadmsvcjobs
pause
如果我們第一次部署InfoPath表單,可以僅使用uploadformtemplate和activateformtemplate即可。
補充說明:
a、execadmsvcjobs此命令可以保證下達的任務馬上執行。我們在實際部署中經常遇到部署后10多個小時,新的InfoPath設計才生效。
b、為什么我們重新部署的時候需要先反激活InfoPath表單,然后再重新激活呢?因為InfoPath表單新的設計使用的站點不重新激活的話,新的設計信息將不生效。
以上問題在我們手工部署InfoPath表單的時候也常常碰到同樣的問題。
?
?
擴展閱讀:
在SharePoint2010中可以通過Feature來部署沙箱的InfoPath表單,以下命令可供使用
Uninstall the existing solution?(based on the from file name):
Uninstall-SPInfoPathFormTemplate -Identity Exampleform.xsn
Install the new solution (based on the from file name):
Install-SPInfoPathFormTemplate -Path C:\Form.xsn
Disable feature on site collection level
Disable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site http://SPSite?
Enable feature on site collection level
Enable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site "http://SPSite"?
?
轉載于:https://www.cnblogs.com/mingle/archive/2011/01/30/1947930.html
總結
以上是生活随笔為你收集整理的深入浅出InfoPath——让管理员来部署InfoPath表单的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 人人开源项目搭建到服务器,人人开源框架的
- 下一篇: 使用nginx 和 switchhost