SPSiteDataQuery and Look-up column

556 views Asked by At

I have a requirement of iterating multiple tasks list under SharePoint sites and sub-sites. I am using SPSiteDataQuery for achieving this. I am having an issue in fetching the data when the column is of type look-up. I am using following code:

query.ViewFields +=FieldRef Name=\"Predecessors\" Type=\"Lookup\" Nullable=\"TRUE\" /;

(Have removed < and " symbol as it is blocking the code)

This fetches all the other columns in the datatable but the value of column Predecessors is always blank for all the rows.

Any pointers in this regard will be highly helpful.

Cheers Chitranshi | SharePoint Consultant| Mindfire Solutions

1

There are 1 answers

0
SharePointer On BEST ANSWER

SPSiteDataQuery does not support multiple value look up columns. However, one can filter the results using SPsiteDataQuery on look up column.

In order to get the values of look up column use SPQuery to iterate through each and every lists which you can get through the SPSiteDataQuery.

In my approach I got the list ids of various lists in my sites and sub-sites using SPSiteDataQuery and using those list ids I fetched the list and the corresponding values for the look-up column using SPQuery.

Cheers Chitranshi | SharePoint Consultant| Mindfire Solutions