Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a custom field definition in VS2010 that contains a lookup field (Title). All is well and I can use the Title ref to add items in the SharePoint list UI. in the instance UI, I can also check one or more of the other fields, as a result of my lookup against my referenced list.

What If I want to include these additional fields in my list CAML definition ... Doesn't seem an obvious way to add to field ref or content type definition.

Indeed if you select a field in the uI and open Karine Bosch's fantastic CAML viewer you seem to get truncated name ... and not the internal name I used

<ViewFields>
  <FieldRef Name='my_x0020_salary_x0020_Item_x0020_' />

</ViewFields>

I guess I need to test with the valid internal name however, it isn't obvious that the field is coming from the referenced list and not the current list definition. I will give this a go and report back unless any one in the SP community can advise....

Daniel

share|improve this question
add comment

1 Answer

Doh

This was so easy...(as even I figured it out!) Just add the additional fields in the schema xmal but use the internal name as normal.. THe CAML viewer seems to want to use the display name which it truncates in the view.

 <View BaseViewID="1" Type="HTML" WebPartZoneID="Main"    
 DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE"
 MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" 
 ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
      <FieldRef Name="Attachments"></FieldRef>
      <FieldRef Name="LinkTitle"></FieldRef>
      <!--  now add the fields from link list definition-->
      <FieldRef Name="DanMenuItemIdRefTitle"> </FieldRef>
      .... here your  list fields go 
      ..... 
      <!-- additonal  fields obtained via the lookup -->
      <FieldRef Name="DanMenuItemIcon"></FieldRef>

    </ViewFields>
share|improve this answer
add comment

Your Answer

 
discard

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.