Loading

ContentVersion's "VersionData" Field Returns Only One Record Per Query Call

Publish Date: May 29, 2026
Description

When querying the Salesforce ContentVersion object and including the VersionData field in your SELECT statement, the API returns only one record at a time rather than the standard default of up to 500 records per query call.

Resolution

Why Only One Record Is Returned
The Salesforce API documentation states that when using the Query API, you may receive fewer than the default 500 records in a QueryResult if the rows are wide — which is the case when retrieving base64-encoded content stored in the VersionData field.

How to Retrieve All Records
To retrieve all ContentVersion records when querying VersionData, use the following approach:
After receiving the initial QueryResult, check the done property:

  • If done is true, all records have been returned.
  • If done is false, there are more records to retrieve.

When done is false, call queryMore using the queryLocator value returned in the initial QueryResult. Continue calling queryMore until done is true.
In Workbench, this behavior is represented by the "More" button that appears after the first result set — clicking it is the equivalent of calling queryMore.

Query: 

Select id,VersionData, Title, Description, FileType,ContentUrl, PathOnClient, ContentSize, TagCsv, Owner.Name, VersionNumber from ContentVersion

 

Knowledge Article Number

000385709

 
Loading
Salesforce Help | Article