locked
Document library view page web part properties Hide using PowerShell Script RRS feed

  • Question

  • 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


    Wednesday, February 26, 2014 10:02 PM

Answers

  • Hi Qiao,

    Thank you for your response. I have used the inline style to hide these sections.

    <style>
    .ms-pivotControl-container{display:none;}
    .ms-InlineSearch-DivBaseline{display:none;}
    .ms-list-addnew{display:none;}
    </style> 

    Thank you,

    Mylsamy

    Monday, March 3, 2014 7:20 PM

All replies

  • Hi,

    Based on my understanding, you can use F12 developing tools to select the web part properties, it should be the string at the last of the control rendering text, like "DisableSaveAsNewViewButton_EDITOR", "InplaceSearchEnabled_EDITOR".

    Thanks,


    Qiao Wei
    TechNet Community Support

    Friday, February 28, 2014 4:51 AM
  • Hi Qiao,

    Thank you for your response. I have used the inline style to hide these sections.

    <style>
    .ms-pivotControl-container{display:none;}
    .ms-InlineSearch-DivBaseline{display:none;}
    .ms-list-addnew{display:none;}
    </style> 

    Thank you,

    Mylsamy

    Monday, March 3, 2014 7:20 PM