我想使用 powershell 脚本在 Web 部件区域中添加 Web 部件
我想仅使用 power shell 脚本以编程方式在 Web 部件区域中添加 Web 部件
我使用 power shell 脚本编写出现此异常 异常
代码
$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
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 = $webpartmanager.ImportWebPart <<<< ($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : NonRefArgumentToRefParameterMsg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过错误消息建议的内容(请注意在
$errorMsg
之前添加[ref]
)?Have you tried what the error message suggests (note the addition of
[ref]
before$errorMsg
)?