Hi All,
I am trying to understand how to display a lookup column within a PowerShell Query without any luck. The PowerShell query displays the list data OK, but the lookup column
data is blank. The column I am trying to display is called 'Category' and is a lookup to the Categories list Title field.
<Eq>
<FieldRef Name='Category' />
<Value Type='Lookup'>Beverages</Value>
</Eq>
*****
PowerShell Code:
$web=Get-SPWeb"http://Robin/"
$list=$web.Lists["Products"]
$query=New-Object Microsoft.SharePoint.SPQuery
$query.query=
" <Where>"+
" <And>"+
" <Contains>"+
" <FieldRef Name='LinkTitleNoMenu' />"+
" <Value Type='Computed'>c</Value>"+
" </Contains>"+
" <Eq>"+
" <FieldRef Name='Category' />"+
" <Value Type='Lookup'>Beverages</Value>"+
" </Eq>"+
" </And>"+
"</Where>"
$items=$list.getItems($query)
$items|select Title, id,Lookup,Category
$web.Dispose()
I hope you can help
Colin