S-Drive 3.6 Documentation

getThumbnailURL

Returns a temporary, expiring URL for a single file's thumbnail.

Only works for a file that already has a generated thumbnail. S-Drive generates thumbnails automatically for supported file types (documents, images, videos) when the Preview and Thumbnail feature is enabled — if a file has no thumbnail, this returns an error.

How to call this method

global static String getThumbnailURL(String parentId, String fileObjectId, Long timeValue)

global static String getThumbnailURL(String parentId, String fileObjectId, Long timeValue, Map<String,String> requestParameters)

Parameters

Parameter

Type

Required

Description

parentId

String

Yes

Id of the parent object the file belongs to. Accepts both 15- and 18-character Salesforce Id formats.

fileObjectId

String

Yes

Id of the file record to get a thumbnail URL for. To get an older version's thumbnail instead of the current one, pass that version's file record Id here.

timeValue

Long

Yes

How long the URL stays valid, in seconds.

requestParameters

Map<String,String>

No

Extra request parameters for the URL — most notably response-content-disposition, which controls whether the URL opens the thumbnail inline or downloads it. See getThumbnailURLs for the full explanation.

Return value

Returns a String — the URL for the file's thumbnail.

Example

String thumbnailURL = cg.SDriveTools.getThumbnailURL(acct.Id, fileId, 1 * 60); // expires in one minute