Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Document library view page web part properties Hide using PowerShell Script

$
0
0

Hi Team,

I need to hide(disable) the"Disable view selector menu","Disable 'Save This View' button","Display search box" property in the "Miscellaneous" section Document library view web part properties options using power shell script.

Please let me know how we can disable these properties from document library view page web part using script . I have tried the below code and not able to get the exact web part property names for this options.


## check to ensure Microsoft.SharePoint.PowerShell is loaded if not using the SharePoint Management Shell 
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} 
if ($snapin -eq $null) 
{    
Write-Host "Loading SharePoint Powershell Snapin"    
Add-PSSnapin "Microsoft.SharePoint.Powershell" 
}

$webpartproperty ="Send first row to connected Web Parts when page loads"
$currentsite= Get-SPSite "SiteCollectionName"
$SPWeb = $currentsite.OpenWeb()
$page = $SPWeb.GetFile("DocumentLibraryName/Forms/All%20Jobs%20Details.aspx")  
 
## $page.CheckOut()     
 $webpartmanager = $SPWeb.GetLimitedWebPartManager("DocumentLibraryName/Forms/All%20Jobs%20Details.aspx",[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)    
 
  for($i=0;$i -lt $webpartmanager.WebParts.Count;$i++)  
  {    
  if($webpartmanager.WebParts[$i].title -eq "DocumentLibraryName")   
  {     
     $wp=$webpartmanager.WebParts[$i];  
     ##$temp = $wp.SchemaXml;
     $wp.ChromeType="TitleAndBorder";  
    
     ##Save changes to webpartmanager. This step is necessary. Otherwise changes won't be reflected  
     $webpartmanager.SaveChanges($wp);  
     break;   
   
  }   
 }   
   

Thank you,

Mylsamy



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>