I'm trying to access the properties (column/field metadata) from old file versions in a document library, via SharePoint's web API.
I can successfully query the library to get a list of files with their current versions using https://example.sharepoint.com/sites/[sitecollection]/_api/web/GetFolderByServerRelativeUrl('/sites/[sitecollection]/[libraryname]')/files
, which exposes the URL for querying the file versions and file properties for each file in the library:
.../_api/web/GetFileByServerRelativeUrl('/sites/[sitecollection]/[libraryname]/[filename]')/Versions
.../_api/web/GetFileByServerRelativeUrl('/sites/[sitecollection]/[libraryname]/[filename]')/Properties
Unfortunately I can't find a way of getting the properties for a particular version of a given file. I've tried calling the Properties
and ListItemAllFields
endpoints for a file version (using both GetFileByServerRelativeUrl()
and the _api/SP.FileVersione[guid]
URL returned by the /Versions
call), as well as providing the virtual location of the file version _vti_history/[version]/[libraryname]/[filename]
as the argument for GetFileByServerRelativeUrl()
, but all result in errors.
I've checked the SharePoint Files and Folders REST API documentation and there seems to be only a small subset of properties available for file versions, compared with normal files. Neither Properties
nor ListItemAllFields
are among them.
Where should I go from here?