none
SharePoint 2010 SPSiteDataQuery with Lookup additional columns. RRS feed

  • Question

  • Hello

    I am trying to use SPSiteDataQuery to collect data across different sites. The query seems to fail when I add Lookup additional data columns. I mean when we create a lookup column, sharepoint 2010 allows us to get data from additional columns from the lookup list. When I try to include these columns SPSiteDataQuery is failing. This is the viewfields that I am using.

    "<FieldRef Name='ID' Nullable='True'/><FieldRef Name='Lookup' /><FieldRef Name='Lookup_x003a_Title'/><FieldRef Name='LinkTitle' Nullable='True'/><FieldRef Name='Created' Nullable='True'/><FieldRef Name='Modified' Nullable='True'/><FieldRef Name='ID' Nullable='True'/>"

    In here the Lookup_x003a_Title (displayname : Lookup:Title) is the column that bring data from the Title column ofthe lookup list.

    Any help is greatly appreciated. The query works fine without Lookup:Title column.

    Thanks

    Vijay

    • Moved by Mike Walsh FIN Thursday, November 4, 2010 4:27 PM SP 2010 q (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Thursday, November 4, 2010 2:57 PM

Answers

All replies

  • Is the lookup field a multi-valued lookup field? In SP2007 SPSiteDataQuery did not support returning anything if you included this type of field in your view fields.
    Blog | SharePoint Field Notes Dev Tool | ClassMaster
    Thursday, November 4, 2010 8:01 PM
  • I was running into a similar problem with customizing a content query web part. In the CommonViewFields property, I had a reference to one of my additional lookup columns, which was Category_x003a_Title. When I referenced this column in my custom XSLT, however, I could never get a value. After banging my head against the wall for a while, I found some other XSLT that iterates through all the available fields and displays them in the CQWP: http://spyralout.com/2009/10/30/cqwp-content-query-web-part-display-all-fields-values/ To my surprise, it turns out the CQWP, for whatever reason, "changed" the internal name to Category_x005F_x003a_Title. When I updated my XSLT to use Category_x005F_x003a_Title, it would then display the values correctly, even though the CommonViewFields property was still set to Category_x003a_Title. I guess what I'm saying is, you might want to try querying the field with the additional _x005F_ in the internal name.
    Wednesday, November 9, 2011 1:24 AM