getFolderContentsById

getFolderContentById(options)

Method Description

This method allows you to retrieve a specific folders contents by a specific ID. It can also retrieve files and get full access of sub-folders.

Returns

DirectoryItem[]

Supported Script Types

SuiteScript 2.1
Server-side Scripts: User Event, Suitelet, RESTlet, Map/Reduce, Scheduled, Workflow Action

Limitations

File size capacity is limited to files 10MB or smaller

Module

b4cd-file-api-lib.js
See notes on how to load this module: FileSync API for SuiteScript

Since

FileSync 0.5.2

Parameters

Note: The options parameter is a JavaScript object.

ParameterTypeRequiredDescriptionSince
options.folderUniqueId
string

required
The unique ID of the folder for which the content is being requested. This value is generally retrieved by making a call to the getRecordFolderContents or the getFolderContentsByPath method.0.5.2

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.2
options.includeSubFolders
booleanoptional

Set the value to true to include sub-folder contents in the result.

Default value: false
Limitations: each sub-folder included will require another HTTP request to the file hosting platform and will thus count toward the NetSuite governance limits. It is not recommended to use this option on folders with a large number of child records. 

0.5.2

Returns

PropertyTypeDescriptionSince
DirectoryItem.name

string

The file or folder name

0.5.2

DirectoryItem.uniqueId
stringThe unique ID of the file or folder as assigned by the file hosting service. 0.5.2
DirectoryItem.type
stringPossible Values: "file", "folder"0.5.2
DirectoryItem.fileSize
integerFile size in bytes.0.5.2
DirectoryItem.apiUri
stringThe URI used to access the file or folder via the API. 0.5.2
DirectoryItem.filePath
stringThe relative file or folder path on the file hosting service starting from the base directory. 0.5.2
DirectoryItem.uri
stringThe 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.2
DirectoryItem.fileContent
stringfile contents as encoded Base64 content0.5.2
DirectoryItem.parentFolderName
stringIf options.includeSubfolders is true this value will return the parent folder name of the directory item.0.5.2
DirectoryItem.parentFolderUniqueId
stringIf options.includeSubfolders is true this value will return the parent folder unique ID of the directory item.
0.5.2

Errors

Error CodeDetails
MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

Example Usage

var params = {
             'folderUniqueId': "5e433228-d3d6-4452-bc37-d2f8867dde29",
             'recordTypeConfigId':35,
             'includeSubFolders'
           }
var content = fileapi.getFolderContentById(params)

Was this article helpful?