Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Problems retrieving field "Author" of a related list of a join with SPQuery

$
0
0

I have a spquery using join to retrieve data from two lists.

I want to retrieve the field "Author" of child list. I use the projectedfields but the query return an error.

It seems that because of the parent child having also a field name "Author", you can not retrieve the value of the field "Author" of the child list.

Is there any way to retrive that value in the SPQuery?

$spquery = New-Object Microsoft.SharePoint.SPQuery

$spquery.Joins = "
<Join Type='LEFT' ListAlias='List1'>
<Eq>
<FieldRef Name='CodigoPeticion' RefType='Id' />
<FieldRef List='List1' Name='ID' />
</Eq>
</Join>
"
$spquery.ProjectedFields = "<Field Name='Author' Type='Lookup' List='List1' ShowField='Author' />"
$spquery.ViewFields = "<FieldRef Name='Author' />"


$outcomes=$miweb.Lists["Planes"]
$result=$outcomes.GetItems(($spquery))

$result|foreach {$_.item("Author")}


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images

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