I am trying to iterate through a collection of document libraries and run code on the ones that are of a particular Content-Type. The if statement is being disregarded entirely and the write-host $contentType.Name
is firing for every list in the foreach block. What is wrong with the if statement?
function PopulateData($web, $includeFileSize) {
Write-Host "Current Site " $web.url -ForegroundColor Cyan
#$libs = Get-PnPList -Web $web | Select-Object AllowContentTypes | Where-Object{($_.AllowContentTypes -eq $true)}
$libs = Get-PnPList -Web $web | Where-Object{($_.BaseType -eq 1)}
foreach($lib in $libs) {
write-host "Library Title ############# " $lib.Title
$ContentTypes = Get-PnPContentType -List $lib
foreach($contentType in $ContentTypes) {
if($contentType.Name -eq 'Knowledge Document' -or 'TELL Document') {
write-host $contentType.Name
}
}
}
}
if(($contentType.Name -eq 'Knowledge Document') -or ($contentType.Name -eq 'TELL Document'))