开发者

I want to add web part in web part zone using powershell script

开发者 https://www.devze.com 2023-03-10 09:03 出处:网络
I want to add web part in the web part zone programmatically only using power shell script I am getting this exception using power shell scripting

I want to add web part in the web part zone programmatically only using power shell script

I am getting this exception using power shell scripting

Exception code

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



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


Have you tried what the error message suggests (note the addition of [ref] before $errorMsg)?

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

精彩评论

暂无评论...
验证码 换一张
取 消