kwizcom banner advertisement

SharePoint Online: How to Hide a List or Library using PowerShell?

Requirement: Hide a list or library from SharePoint Online site.
hide list or document library in sharepoint online using powershell

SharePoint Online: Hide Document Library using PowerShell
There are many ways to hide a SharePoint online list. Here is the PowerShell CSOM script to create hidden lists in SharePoint online.  
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
  
#Config Parameters
$SiteURL= "https://crescent.sharepoint.com/sites/sales/"
$LibraryName="ProjectConfig"

#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Cred
  
    #Get the web and Library
    $Web=$Ctx.Web
    $List=$web.Lists.GetByTitle($LibraryName)

    #Hide the list
    $List.Hidden = $True
    $List.Update()
    $Ctx.ExecuteQuery()
     
    Write-host -f Green "List hidden Successfully!"
}
Catch {
    write-host -f Red "Error hiding List: " $_.Exception.Message
}

We can also use SharePoint Designer to mark a list hidden from browser. Read more here: How to hide a list in SharePoint?
how to hide list in sharepoint online

Tags: sharepoint online hidden list, sharepoint online hide task list, sharepoint online create hidden list
SharePoint Online: How to Hide a List or Library using PowerShell? SharePoint Online: How to Hide a List or Library using PowerShell? Reviewed by Salaudeen Rajack on November 08, 2016 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.