How to Retrieve Custom Field Values for SharePoint File Versions
Question details
The user needs to retrieve historical custom field values associated with specific file versions in SharePoint using the REST API.

- Product
- SharePoint
- Device & OS
- not provided
- Scenario
- Developing or integrating a solution that reads historical custom metadata from previous SharePoint file versions.
- Observed behavior
- Expanding ListItemAllFields or FieldValuesAsText on a file version returns the current item's fields instead of the custom fields for that specific version.
Ensure you have the appropriate site collection administrator or developer permissions to run SharePoint REST API queries and access version history.
Use Separate Requests for List-Item Versions
Make targeted REST API calls to the list-item version endpoint rather than relying on file version expansion.
Because SharePoint treats file versions and list-item field versions independently in the REST API, expanding ListItemAllFields on a file version object defaults to the current metadata state. To retrieve historical metadata, you must query the list item's version history directly.
Query the SharePoint file to retrieve the specific file version identifier (VersionId) you want to investigate.
Construct a REST API request targeting the list item's versions directly, typically using _api/web/lists/getbytitle('ListName')/items(ItemId)/versions.
Filter or select the specific VersionId in your query to extract the historical custom field values associated with that exact version.

Consult SharePoint Developer Communities
Ask for version-specific REST API guidance from Microsoft engineers if direct endpoints do not expose the required fields.
Manage Your Documents Seamlessly with WPS Office
While you troubleshoot advanced SharePoint REST API configurations, consider WPS Office as a lightweight, comprehensive alternative for your everyday document creation and editing needs. It offers high compatibility with Microsoft Office formats without the hefty price tag.
- 1. Download the Installer: Visit the official WPS website and click 'Download WPS Office Free'.
- 2. Install WPS Office: Run the downloaded installer and follow the quick on-screen instructions.
- 3. Open Your Documents: Easily open your existing .docx, .xlsx, and .pptx files directly in WPS Office with zero formatting loss.

Frequently Asked Questions
Why does ListItemAllFields return current metadata instead of historical?
In the SharePoint REST API, expanding ListItemAllFields from a file version object defaults to the current list item state rather than providing a snapshot of the fields at that specific historical version.
How can I access historical metadata for a SharePoint document?
You must query the 'versions' endpoint of the specific list item (e.g., /items(id)/versions) rather than relying on the file version's expanded properties to see past metadata changes.
Does the SharePoint REST API support expanding FieldValuesAsText for past versions?
No, similar to ListItemAllFields, expanding FieldValuesAsText on a past file version typically yields the current text values. You need to pull the specific list item version directly.




