0

Executing the following query

"Select C.Title FROM ContentVersion C WHERE ContentDocumentId IN (SELECT ContentDocumentId FROM ContentWorkspaceDoc WHERE ContentWorkSpaceId='".LIBRARY_ID."')"

which gives me a big list of files in the library with Id LIBRARY_ID

As soon as I add

"Select C.Title,C.VersionData FROM..."

I only get one record. Only one of 8 records is a link, so what foolishness am I performing to get this undesired behavior?

Does VersionData require some additional privileges?

xn.
  • 15,776
  • 2
  • 30
  • 34
Brooks
  • 2,082
  • 2
  • 18
  • 26

2 Answers2

1

When using the API, you may receive fewer than the default 500 records in a QueryResult if the rows are wide, which they will be when retrieving the base64-encoded content stored in VersionData. You should check the done property, and call queryMore with the queryLocator to get more rows. See http://bit.ly/KEEo7M.

xn.
  • 15,776
  • 2
  • 30
  • 34
0

I had the same issue. I'd suggest you to run this same query in Anonymous window in developer console and you'll surely run into heap size error.

This happens when you exceed the governor limit ,which is 6mb for synchronous process. VersionData consists binary representation of file available in contentversion.

If you are using this query in your apex code, I'd suggest you to use batch apex for this one, only if the file size in versionData is < 12mb.