Current situation:
=============
In my example, I've got 2 custom lists:
- Accounts
- Addresses
In the "Accounts"-list I've created 2 lookup columns to the "Addresses"-list
- Address1
- Address2
When I try to create a CAML query, I can succesfully get listitems with each join separately:
<Join Type='INNER' ListAlias='Addresses'>
<Eq>
<FieldRef Name='Address1' RefType='Id'/>
<FieldRef List='Addresses' Name='ID'/>
</Eq>
</Join>
But when I try to add a second one (for Address2) WITH different ListAlias it throws an exception:
<Join Type='INNER' ListAlias='Address1'>
<Eq>
<FieldRef Name='Address1' RefType='Id'/>
<FieldRef List='Addresses' Name='ID'/>
</Eq>
</Join>
<Join Type='INNER' ListAlias='Address2'>
<Eq>
<FieldRef Name='Address2' RefType='Id'/>
<FieldRef List='Addresses' Name='ID'/>
</Eq>
</Join>
ERROR:
=============
{System.ArgumentException: Value does not fall within the expected range.
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()
at Microsoft.SharePoint.SPListItemCollection.get_Count()
at ...}
Question:
=============
Does anyone have any idea how to solve this?
Changing the ListAlias to Address1 and Address2 does not work either... but according to this: http://msdn.microsoft.com/en-us/library/ee535061(v=office.14).aspx it should...