obj objRef createAndLoad

Available for: Content Management Server

Task: Creates a new file with a draft version and loads the specified blob. The specified file in which the new file is to be created must be a folder.

Syntax:

obj (withId objId) | (withPath path) | root createAndLoad {parameter value}

Additional information:

  • One of the parameters blob, blob.plain, blob.base64, blob.stream or file must be specified. If more than one of these parameters is specified, it is undefined which one is evaluated.
  • The contentType parameter (file name extension) must be set.
  • Specifying the file format is not necessary if a file name extension was specified which is a validContentType in only one format, so that the format can be determined uniquely.

Function parameters:

  • parameter is the name of a parameter important for file creation. The value of this parameter is specified in the corresponding value parameter. parameter can be:
    • blob, blob.plain, blob.base64 or blob.stream specifies that value contains the properly encoded version to import or, respectively, that value contains a streaming ticket under which the version to import was uploaded. If several of these parameters are specified, it is undefined which one is evaluated.
    • charset: the character set of the blob (for file types other than image and resource). If not specified, the character set is taken from the charset user preference. The Version Manager converts the blob to UTF-8. The list of the available character sets can be determined with the Tcl command encoding names.
    • contentType: The blob’s file name extension.
    • file: The path of the correctly encoded file to import. The path can be composed of up to two components. It is relative to the user’s temporary directory and must not begin with the parent directory. This parameter is intended to be used by developers only.
    • objClass: The name of the format to be assigned to the new file.
    • name: The name the new file is to receive. A name is generated if none is specified.
    • suppressExport: Specifies whether this file is to be exported.
  • value contains the value of the respective parameter.

Return value if successful: the ID of the new file (string)

Necessary permissions (CM only):

  • The user must have the permissionCreateChildren permission in the target folder.
  • The user must have the global file creation permission set in the format of the target file.

Example:

CM>obj root createAndLoad name news objClass newspub \
blob.base64 [encodeFile /opt/NPS/upload/newslist.html]
news