Check if a Person or Group column is empty in PowerShell
-
15-02-2021 - |
Pergunta
I have a Task owner column in SharePoint which is a Person or Group column. I am trying to check if this column is empty in Powershell
if($_["Task Owner"] -eq null)
This gives me the below error
you must provide a value expression following the '-eq' operator
Any help would be appreciated, TIA
Solução
The issue is that PowerShell expects null
value to be specified as $null
,
In your case, this is the correct syntax:
if($_["Task Owner"] -eq $null)
Outras dicas
My bad, I missed the $ in front of the null
It worked once I changed null to $null
if($_["Task Owner"] -eq $null)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange