0

I'va a custom list which contains a lookup field to a document library. Now I need to retrieve all items from this list with the corresponding file name from the document library with Javascript CSOM.

It seems like I can make a join for retrieving the title field, but I get an error as soon as I try to retrieve the FileLeafRef field (Value does not fall withing the expected range).

Here the CAML query which I use:

<View>
  <ViewFields>
    <FieldRef Name="myLookupField" />
    <FieldRef Name="DocTitle" />
    <FieldRef Name="DocName" />
  </ViewFields>
  <ProjectedFields>
    <Field Name="DocTitle" Type="Lookup" List="myDocumentLibrary" ShowField="Title" />
    <Field Name="DocName" Type="Lookup" List="myDocumentLibrary" ShowField="FileLeafRef" />
  </ProjectedFields>
  <Joins>
    <Join Type="Left" ListAlias="myDocumentLibrary">
      <Eq>
        <FieldRef Name="myLookupField" RefType="Id" />
        <FieldRef List="myDocumentLibrary" Name="Id" />
      </Eq>
    </Join>
  </Joins>
</View>

If I remove FileLeafRef from the query it works. Any idea what's the error here?

0

I assume my problem might be that the type of the FileLeafRef column (File) is not supported in CAML joins as noted here: http://msdn.microsoft.com/en-us/library/ee539975%28v=office.14%29.aspx

Only the following types of fields can be included in a ProjectedFields element:
    Calculated (treated as plain text)
    ContentTypeId
    Counter
    Currency
    DateTime
    Guid
    Integer
    Note (one-line only)
    Number
    Text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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