Wednesday, December 10, 2014

How to hide site contents items in SharPoint 2013 in powershell

Power Shell
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$url = "http://yoursite/"
#publishFedd
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["MicroFeed"]
$list.Hidden = 1;
$list.Update()
$spWeb.Dispose()
Write-Host "Hiding on the PublishedFeed"
#Shared Documents
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Documents"]
$list.Hidden = 1;
$list.Update()
$spWeb.Dispose()
Write-Host "Hiding on the Shared Documents"
#Site Assest
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Site Assets"]
$list.Hidden = 1;
$list.Update()
$spWeb.Dispose()
Write-Host "Hiding on the Site Assest"
#Style%20Library
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Style Library"]
$list.Hidden = 1;
$list.Update()
$spWeb.Dispose()
Write-Host "Hiding on the Style Library"
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Site Pages"]
$list.Hidden = 1;
$list.Update()
$spWeb.Dispose()
Write-Host "Hiding on the Site Pages"
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$url = "http://yoursite/"
#publishFedd
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["MicroFeed"]
$list.Hidden = 0;
$list.Update()
$spWeb.Dispose()
Write-Host "unHiding on the PublishedFeed"
#Shared Documents
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Documents"]
$list.Hidden = 0;
$list.Update()
$spWeb.Dispose()
Write-Host "unHiding on the Shared Documents"
#Site Assest
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Site Assets"]
$list.Hidden = 0;
$list.Update()
$spWeb.Dispose()
Write-Host "unHiding on the Site Assest"
#Style%20Library
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Style Library"]
$list.Hidden = 0;
$list.Update()
$spWeb.Dispose()
Write-Host "unHiding on the Style Library"
$spWeb = Get-SPWeb $url
$list = $spWeb.Lists["Site Pages"]
$list.Hidden = 0;
$list.Update()
$spWeb.Dispose()
Write-Host "unHiding on the Site Pages"

No comments:

Post a Comment