2011-06-03 63 views
1

我想在Web部件區域中添加Web部件程序只使用電源外殼腳本我想在Web部件區域中添加Web部件使用PowerShell腳本

我使用電源外殼腳本

得到這個例外

異常代碼

 
$webPart = $webpartmanager.ImportWebPart($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] 



Argument: '2' should be a System.Management.Automation.PSReference. Use [ref]. 
+ $webPart = $webpartmanager.ImportWebPart <<<< ($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] 
    + CategoryInfo   : NotSpecified: (:) [], MethodException 
    + FullyQualifiedErrorId : NonRefArgumentToRefParameterMsg 

回答

0

你有沒有嘗試過的錯誤信息顯示的內容(注:將[ref]$errorMsg前)?

$webPart = $webpartmanager.ImportWebPart($xmlReader, [ref]$errorMsg) 
       -as [Microsoft.SharePoint.WebPartPages.WebPart] 
相關問題