在CodePlex上發現了一個很好的Solution,可以對Lookup欄位進行過濾http://sp2010filteredlookup.codeplex.com/下載下來之後是一個wsp檔案:Dev4Side.SP2010.FilteredLookup.wsp 經驗總結:需要用管理員權限需要啟動SharePoint 2010 Administration服務 如果用stsadm,所需命令如下:stsadm -o addsolution -filename d:\Sharepoint\Dev4Side.SP2010.FilteredLookup.wsp
stsadm -o deploysolution -name Dev4Side.SP2010.FilteredLookup.wsp -allowgacdeployment -immediate 如果用Powershell,所需命令如下:Add-PSSnapin Microsoft.SharePoint.Powershell (如果直接用SharePoint 2010 Management Shell [開始菜單],這步可省略)Add-SPSolution -LiteralPath d:\Sharepoint\Dev4Side.SP2010.FilteredLookup.wspInstall-SPSolution -Identity dev4side.sp2010.filteredlookup.wsp -GACDeployment -Force如果希望只在某個WebApplication上部署,可以加上-WebApplication 參數,這個參數的值可以是WebApplication的GUID或者WebApplication的名字,要想擷取WebApplication的名字和ID, 可通過執行Get-SPWebApplication得到例如Install-SPSolution -Identity dev4side.sp2010.filteredlookup.wsp -WebApplication "xxxx - 80" -GACDeployment -Force -----------------------------------------------開始試圖用SiteCollection Administrator進行上傳、啟用,上傳後無法啟用成功,提示只能在Farm層級啟用 於是遠端桌面連線到伺服器來部署這個wsp。眾所周知,有兩種方式來做這個事情:stsadm.exe或者Powershell指令碼 首先用Powershell,2010引入的進階方法。當運行第一個命令的時候就出錯了Add-PSSnapin Microsoft.SharePoint.Powershell 以為系統安裝的問題,於是轉為採用stsadm.exestsadm -o addsolution -filename d:\Dev4Side.SP2010.FilteredLookup.wsp還是有錯誤,提示Access denied. 於是忽然意識到,需要用管理員權限來做這個事 Run as Administrator,果然好用stsadm -o addsolution -filename d:\Dev4Side.SP2010.FilteredLookup.wsp 安裝成功後,部署的時候又出問題了,提示這個錯誤:Admin SVC must be running in order to create deployment timer jobGoogle之後得到解決方案,需要啟動SharePoint 2010 Administration服務http://blog.salamandersoft.co.uk/index.php/2011/03/error-admin-svc-must-be-running-in-order-to-create-deployment-timer-job/ 服務啟動完之後,再執行 Install-SPSolution -Identity dev4side.sp2010.filteredlookup.wsp -GACDeployment結果又有錯誤:Install-SPSolution : A deployment or retraction is already under way for
sp", and only one deployment or retraction at a time is supported. 再Google, 得到解決方案:http://vspug.com/ssa/2007/10/22/a-deployment-or-retraction-is-already-under-way-for-the-solution-publishing-infopath-form/運行 Central Administration ,Check job status -> Job Definitions尋找和Solution相關的Timer Job,果然找到一個OneTime的job,點開改job定義,在瀏覽器抵制欄中得到Timer Job ID執行stsadm -o canceldeployment -id 8d1aef38-5237-4824-8335-1b7d602e7eea 然後再運行,Install-SPSolution -Identity dev4side.sp2010.filteredlookup.wsp -GACDeployment,終於成功部署了。所有和Solution相關的命令http://www.cnblogs.com/mybi/archive/2011/04/07/2008058.html
Published by Wiz