getFileContentById
getFileContentById(options)
Method Description | This function allows you to get a file from an external file storage location and returns its contents in Base 64 encoding. |
Returns | |
Supported Script Types | SuiteScript 2.1 |
Limitations | File size capacity is limited to files 10MB or smaller |
Module | b4cd-file-api-lib.js |
Since | FileSync 0.5.0 |
Parameters
Note: The options
parameter is a JavaScript object.
Parameter | Type | Required | Description | Since |
---|---|---|---|---|
options.fileUniqueId | string | required | The unique ID of the file for which the content is being requested. This value is generally retrieved by making a call to the getRecordFolderContents method. | 0.5.0 |
options.recordTypeConfigId | integer | required | Internal ID of the FileSync Record Type Configuration record (customrecord_b4cd_record_type_config). * Either the recordTypeConfigId or the connectionId can be provided. At least one of them is required. | 0.5.0 |
Returns
Property | Type | Description | Since |
---|---|---|---|
| string | The file or folder name | 0.5.0 |
| string | The unique ID of the file or folder as assigned by the file hosting service. | 0.5.0 |
| string | Possible Values: "file", "folder" | 0.5.0 |
| integer | File size in bytes. | 0.5.0 |
| string | The URI used to access the file or folder via the API. | 0.5.0 |
| string | The relative file or folder path on the file hosting service starting from the base directory. | 0.5.0 |
| string | The user-navigable URI for the folder or file on the file hosting platform. This can be used to construct hyperlinks for users to reach the file or folder externally. | 0.5.0 |
| string | file contents as encoded Base64 content | 0.5.0 |
Errors
Error Code | Details |
---|---|
| A required argument is missing or undefined. |
Example Usage
var params = {
'fileUniqueId': "5e433228-d3d6-4452-bc37-d2f8867dde29",
'recordTypeConfigId':35
}
var content = fileapi.getFileContentById(params)