0

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

1 Answer 1

0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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