3

Is there a way to write the service call in example A to get the file properties in example B? Currently the folder isn't a named list. If it were would that help?

This question is similar to: Is it possible to GET a list of Files in a document library with "extended properties". I'm using the answer, but still not getting the properties I want in one pass. I have to call example B for every file.

File properties - example A:

_api/web/GetFolderByServerRelativeUrl(<folderpath>)/Files?$expand=Properties

<m:properties>
  <d:CheckInComment /> 
  <d:CheckOutType m:type="Edm.Int32">2</d:CheckOutType> 
  <d:ContentTag>{9D4E82A3-EBF0-4A29-BCF5-1B10951901D1},6,10</d:ContentTag> 
  <d:CustomizedPageStatus m:type="Edm.Int32">0</d:CustomizedPageStatus> 
  <d:ETag>"{9D4E82A3-EBF0-4A29-BCF5-1B10951901D1},6"</d:ETag> 
  <d:Exists m:type="Edm.Boolean">true</d:Exists> 
  <d:Length m:type="Edm.Int64">82805</d:Length> 
  <d:Level m:type="Edm.Byte">1</d:Level> 
  <d:MajorVersion m:type="Edm.Int32">3</d:MajorVersion> 
  <d:MinorVersion m:type="Edm.Int32">0</d:MinorVersion> 
  <d:Name>O0032C - Decline letter.docx</d:Name> 
  <d:ServerRelativeUrl>/sites/s3vdfnl/docs/general/S0032/O0032C - Decline letter.docx</d:ServerRelativeUrl> 
  <d:TimeCreated m:type="Edm.DateTime">2015-04-09T12:45:11Z</d:TimeCreated> 
  <d:TimeLastModified m:type="Edm.DateTime">2015-04-09T12:45:11Z</d:TimeLastModified> 
  <d:Title>Decline Letter NL</d:Title> 
  <d:UIVersion m:type="Edm.Int32">1536</d:UIVersion> 
  <d:UIVersionLabel>3.0</d:UIVersionLabel> 
  </m:properties>
<m:properties>

File properties - example B:

_api/web/GetFileByServerRelativeUrl(<filepath>)/ListItemAllFields?expand=Properties"

<m:properties>
    <d:FileSystemObjectType m:type="Edm.Int32">1</d:FileSystemObjectType>
    <d:Id m:type="Edm.Int32">8</d:Id>
    <d:Title m:null="true" />
    <d:ID m:type="Edm.Int32">8</d:ID>
    <d:ContentTypeId>0x0120006AEEB7D3E4E35F49A2777DEF7274B7E9</d:ContentTypeId>
    <d:Created m:type="Edm.DateTime">2015-01-23T22:56:12Z</d:Created>
    <d:AuthorId m:type="Edm.Int32">11</d:AuthorId>
    <d:Modified m:type="Edm.DateTime">2015-01-23T22:56:12Z</d:Modified>
    <d:EditorId m:type="Edm.Int32">11</d:EditorId>
    <d:OData__CopySource m:null="true" />
    <d:CheckoutUserId m:null="true" />
    <d:OData__UIVersionString>1.0</d:OData__UIVersionString>
    <d:GUID m:type="Edm.Guid">c7093817-f264-4e85-845c-4989aa66e142</d:GUID>
    <d:md7package m:null="true" />
</m:properties>
steve
  • 55
  • 2
  • 2
  • 5
  • Robert, i revised the question to make it more clear. I saw the duplicate post you were referring to and variations on the answer haven't helped either. I also have tried the suggestions in this post too: http://sharepoint.stackexchange.com/questions/138135/get-all-files-and-folders-in-one-call – steve Aug 30 '15 at 03:22
  • I need to get the file details when I tapped on file in the folder and that file is open in browser or web view? – GOPI KRISHNA Oct 22 '21 at 19:10

1 Answers1

9

You probably want this query: /_api/web/getfolderbyserverrelativeurl('<url>')/Files?$expand=ListItemAllFields

It will return files properties along with associated list item properties.

Vadim Gremyachev
  • 42,498
  • 3
  • 86
  • 167