问题描述
您好,
目前,我们要处理的任务是具有listview Webpart且所有WebPart的工具栏类型都设置为none的页面,我们需要将其更新为Full工具栏类型.所以我厌倦了为Powershell工作以更新工具栏类型 特定页面上的listview webpart,但是我无法使用powershell更新listviewxml.
Currently we have at task where there are number of pages where we have listview webpart and all the webpart has toolbar type set to none which we need to update it to Full toolbar type. So I tired working for Powershell to update toolbar type for listview webpart on particular page but I am not able to update the listviewxml using powershell.
感谢您的帮助.
$ web = Get-SPWeb"http://teams..com/Test" #url
$ webpartmanager = $ web.GetLimitedWebPartManager("default.aspx",[System.Web.UI.WebControls.WebParts.PersonalizationScope] :: Shared)#获取Webpart管理器类
for($ i = 0; $ i -lt $ webpartmanager.WebParts.Count; $ i ++)
{
if($ webpartmanager.WebParts [$ i] .title -eq"Documents") #列表标题
{
$ wp = $ webpartmanager.WebParts [$ i]
$web= Get-SPWeb "http://teams..com/Test" #url
$webpartmanager = $web.GetLimitedWebPartManager("default.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) #Get the webpart manager class
for($i=0;$i -lt $webpartmanager.WebParts.Count;$i++)
{
if($webpartmanager.WebParts[$i].title -eq "Documents") #list title
{
$wp = $webpartmanager.WebParts[$i]
$ wp.listviewxml ###在此特定xml中具有工具栏类型属性,您可以让我知道如何更新xml并将工具栏类型属性设置为完整工具栏.
$wp.listviewxml ### We have toolbar type property in this particular xml can you let me know how we can update the xml and set the toolbar type property to full toolbar.
}
}
}
}
推荐答案
这篇关于Powershell更新特定页面上ListView WebPart的工具栏类型.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!