TransWikia.com

How to write Join 4 lists using CAML Query (CSOM)

SharePoint Asked on November 28, 2021

I have four lists in my site. I need to get data from all these lists in CSOM (Provider hosted app). All these lists are connected linearly (one to one).

List 1 -> List 2 -> List 3 -> List 4.

for eg :

List 1

Title List2_Lookup

List 2

Title List3_Lookup

List 3

Title List4_Lookup

List 4

Title

We need to write a CAML Join Query to get the data, However all my queries were failing. Please could someone help me with the join query or show some examples to connect 4 or more lists using CAML.

One Answer

You need to use SPSiteDataQuery instead of SPQuery. MSDN link

However,

The CSOM does not provide a mechanism for querying data across multiple lists that are not associated by a lookup field. In other words, there is no client-side functional equivalent of the SPSiteDataQuery class. If you need to perform a cross-list query from client-side code, consider creating a list view on the server that performs the list aggregation. You can then query the aggregated data from your client-side code. MSDN Link 2

It seems that you need to make 4 separate CAML queries to combine your lists.

Answered by George Andrews on November 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP