I'm trying to get a sharepoint list choice field value using powershell. The choice field contains a yes and no values. now I want to check if it's a Yes and do some logic.
foreach($item in $listItems)
{
$value= $list.items | where {$item["Exported)"] -eq $item["Exported)"]."Yes"
if($value)
{
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -name "Date" -value $item["Date"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Employer" -value $item["Employer"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Employer Number" -value $item["Employer Number"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Classification" -value $item["Classification"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Source" -value $item["Source"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Action" -value $item["Action"]
$ExportItem | Add-Member -MemberType NoteProperty -name "Description" -value $item["Description"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Exported" -value $item["Exported"]
$ListItemCollection += $ExportItem
$ListItemCollection | Export-CSV "C:\Users\Documents\CSV uotput\Test.CSV" -NoTypeInformation
}
}
this exports the data regardless whether the choice field is a "No", what I want to export items that have the choice field as "Yes"
Please assist.