Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Can not display Lookup Field Data within a PowerShell query

$
0
0

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


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>