Caml query not returning fileleafref

%3CLINGO-SUB%20id%3D%22lingo-sub-2156816%22%20slang%3D%22en-US%22%3ECaml%20query%20not%20returning%20fileleafref%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2156816%22%20slang%3D%22en-US%22%3E%3CP%3E%3CBR%20%2F%3EI%20have%20a%20CAML%20query%20that%20I%20am%20running%20through%20the%20REST%20api%2C%20the%20simple%20example%20below%20requests%202%20fields%20-%20FileLeafRef%20and%20CustomField.%20Custom%20field%20is%20simple%20a%20text%20field%2C%20nothing%20special.%3CBR%20%2F%3E%3CBR%20%2F%3ECustomField%20is%20returned%20whereas%20FileLeafRef%20is%20not.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20I%20run%20the%20same%20CAML%20via%20CSOM%20or%20the%20old%20WCF%2Fsoap%20based%20services%20then%20FileLeafRef%20is%20returned...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3CVIEW%20scope%3D%22RecursiveAll%22%3E%0A%20%20%3CQUERY%3E%0A%20%20%20%20%3CWHERE%3E%0A%20%20%20%20%20%20%3CEQ%3E%0A%20%20%20%20%20%20%20%20%3CFIELDREF%20name%3D%22FileRef%22%3E%3C%2FFIELDREF%3E%0A%20%20%20%20%20%20%20%20%3CVALUE%20type%3D%22Text%22%3E%2FSomeSite%2FSomeDocumentLibrary%2FSomeFile.txt%3C%2FVALUE%3E%0A%20%20%20%20%20%20%3C%2FEQ%3E%0A%20%20%20%20%3C%2FWHERE%3E%0A%20%20%3C%2FQUERY%3E%0A%20%20%3CROWLIMIT%3E1%3C%2FROWLIMIT%3E%0A%20%20%3CVIEWFIELDS%3E%0A%20%20%20%20%3CFIELDREF%20name%3D%22FileLeafRef%22%3E%3C%2FFIELDREF%3E%0A%20%20%20%20%3CFIELDREF%20name%3D%22CustomField%22%3E%3C%2FFIELDREF%3E%0A%20%20%3C%2FVIEWFIELDS%3E%0A%3C%2FVIEW%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20know%20I%20can%20use%20a%20%24select%20querystring%2C%20but%20this%20is%20on%20an%20app%20that%20the%20user%20can%20specify%20any%20number%20of%20columns%20to%20retrieve%20and%20querystrings%20have%20a%20limit.%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20is%20there%20something%20I%20am%20missing%3F%20Or%20does%20REST%20CAML%20act%20differently%20to%20the%20other%20two...%3CBR%20%2F%3E%3CBR%20%2F%3EN.b%20this%20is%20against%20SharePoint%20Online%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20should%20add%20this%20is%20being%20called%20via%20a%20post%20to%20an%20endpoint%20like%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2FSomeSite%2F_api%2Fweb%2Flists(guid'listGuid')%2Fgetitems%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2FSomeSite%2F_api%2Fweb%2Flists(guid'listGuid')%2Fgetitems%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2156816%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor


I have a CAML query that I am running through the REST api, the simple example below requests 2 fields - FileLeafRef and CustomField. Custom field is simple a text field, nothing special.

CustomField is returned whereas FileLeafRef is not.

If I run the same CAML via CSOM or the old WCF/soap based services then FileLeafRef is returned...

 

<View Scope="RecursiveAll">
  <Query>
    <Where>
      <Eq>
        <FieldRef Name="FileRef" />
        <Value Type="Text">/SomeSite/SomeDocumentLibrary/SomeFile.txt</Value>
      </Eq>
    </Where>
  </Query>
  <RowLimit>1</RowLimit>
  <ViewFields>
    <FieldRef Name="FileLeafRef" />
    <FieldRef Name="CustomField" />
  </ViewFields>
</View>



I know I can use a $select querystring, but this is on an app that the user can specify any number of columns to retrieve and querystrings have a limit.

So is there something I am missing? Or does REST CAML act differently to the other two...

N.b this is against SharePoint Online

 

I should add this is being called via a post to an endpoint like https://tenant.sharepoint.com/SomeSite/_api/web/lists(guid'listGuid')/getitems

0 Replies