Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've three lists: Competitions, Works and WorksVotes, linked to each other through Lookup fields. WorksVotes list has Lookup field to Works list, and Works list has Lookup field to Competitions list. What I need is to display the Competition in the WorksVotes list. I wrote some CAML code with 2 Joins which works fine with SPQuery object:

var query = new SPQuery();
                    query.Query = "<OrderBy><FieldRef Name=\"ID\" /></OrderBy>";

                    query.ViewFields = "<FieldRef Name=\"Title\" /><FieldRef Name=\"Attachments\" /><FieldRedf Name=\"LinkTitle\" /><FieldRef Name=\"CompetitionTitle\" />";

                    query.Joins =
                        @"<Join Type=""INNER"" ListAlias=""worksList"">
                              <FieldRef Name=""CompetitionWork"" RefType=""ID"" />
                              <FieldRef Name=""ID"" List=""worksList"" />
                          <Join Type=""INNER"" ListAlias=""competitionsList"">
                              <FieldRef List=""worksList"" Name=""Competition"" RefType=""ID"" />
                              <FieldRef List=""competitionsList"" Name=""ID"" />
                    query.ProjectedFields = "<Field Name=\"CompetitionTitle\" Type=\"Lookup\" List=\"competitionsList\" ShowField=\"Title\" />";

After testing I added this CAML into schema.xml file that defines the WorksVotes list:

   <FieldRef Name="Title"></FieldRef>
   <FieldRef Name="CompetitionTitle"></FieldRef>
          <Join Type="INNER" ListAlias="worksList">
              <FieldRef Name="CompetitionWork" RefType="ID" />
              <FieldRef Name="ID" List="worksList" />
          <Join Type="INNER" ListAlias="competitionsList">
              <FieldRef List="worksList" Name="Competition" RefType="ID" />
              <FieldRef List="competitionsList" Name="ID" />
          <Field Name="CompetitionTitle" Type="Lookup" List="competitionsList" ShowField="Title" />

But in this case I get an SPException telling that the "CompetitionTitle" field is unavailable or does not exist. What I'm doing wrong?

share|improve this question

1 Answer 1

After trying to make projected fields work in views (either defined programmatically or declaratively), I sadly conclude that one cannot use fields from other lists in views by help of Joins and Projected Fields.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.