function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pconpcon
What error specifically are you getting?  Can you also include the line of code that you are attempting to call?

NOTE: When including code, please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
pconpcon
Also, can you please include the API version of the apex class / trigger you are attempting to make the call from
Barton LedfordBarton Ledford
Trying to call the getFilePreview method of ConnectApi.Files but ConnectApi.Files isn't available in API 35.0 so apparently the documentation I linked was published but the functionality wasn't actually released 
pconpcon
I would try reaching out to the documentation team / support to see if this was released early to the documentation or if it's part of a pilot that you have to setup first.
alouie_sfdcalouie_sfdc
Dang, thanks a lot for reporting this. I work for Salesforce and can confirm that it was unintentionally included in the documentation. It's going to be removed.

The same functionality is available in the Chatter REST API in v35.0 in case it helps:
https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_files_preview_format.htm

A workaround in Apex would be to make an HTTP callout to the REST endpoint -- not very nice, but I can't think of a better way.