Function RemoveListfromQuickLaunch
{
param(
[Parameter(Mandatory = $true)][string]$ListName
)
try
{
$dst_ctx = New-Object Microsoft.SharePoint.Client.ClientContext($row.dstUrl)
$dst_creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($dst_username,$spopassword)
$dst_ctx.Credentials = $dst_creds
$dst_web = $dst_ctx.Web
$dst_ctx.Load($dst_web)
$dst_ctx.ExecuteQuery();
$OnQuickLaunch = $False
#Get the context
$ctx = Get-PnPContext
$List= $ctx.web.lists.GetByTitle($ListName)
$ctx.Load($List)
$ctx.ExecuteQuery()
If ($List.BaseTemplate -eq 101)
{
$List.OnQuickLaunch = $False
$List.Update()
$List.ExecuteQuery()
}
}Catch
{
write-host Could not remove library $($ListName) from QuickLaunch - $_.Exception.Message -ForegroundColor Red
$e = $_.Exception
$line = $_.InvocationInfo.ScriptLineNumber
$msg = $e.Message
}
}