uploadFile
uploadFile(options)
Method Description | This function allows you to create a new file in SharePoint. |
Returns | DirectoryItem |
Supported Script Types | SuiteScript 2.1 |
Limitations | Non-Text files: 10MB |
Module | b4cd-file-api-lib.js |
Since | FileSync 0.5.1 |
Parameters
Note: The options
parameter is a JavaScript object.
Property | Type | Required | Description | Since |
---|---|---|---|---|
| integer | required | The internal ID of the record in NetSuite which we are associating the new file to. | 0.5.1 |
| string | required | The name for the new file, the file extension must be added for file to be created ie: .txt, .cvs, .pdf, or .png | 0.5.1 |
| string | required | The fileContents needs to be UTF-8 for text based files, all other file types such as PDF and PNG need to be uploaded with Base64 encoding | 0.5.1 |
| integer | required | Internal ID of the FileSync Record Type Configuration record (customrecord_b4cd_record_type_config). | 0.5.1 |
Returns
Property | Type | Description | Since |
---|---|---|---|
| string | The file or folder name | 0.5.1 |
| string | The unique ID of the file or folder as assigned by the file hosting service. | 0.5.1 |
| string | Possible Values: "file", "folder" | 0.5.1 |
| integer | File size in bytes. | 0.5.1 |
| string | The URI used to access the file or folder via the API. | 0.5.1 |
| string | The relative file or folder path on the file hosting service starting from the base directory. | 0.5.1 |
| 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.1 |
Errors
Error Code | Details |
---|---|
| A required argument is missing or undefined. |
Example Usage
var params = {
recordId: scriptContext.newRecord.id,
fileName: "listOfItems.csv",
fileContents: storedFileContents,
recordTypeConfigId: 35
}
fileapi.uploadFile(params)