确保节点拥有cm:versionable切面,并且在版本存储中具有初始版本。

在已经开启版本化的节点上调用此方法将没有任何效果。对新上传的节点调用此方法将为其启用版本控制。

ensureVersioningEnabled(autoVersion, autoVersionProps)

参数

  • autoVersion
    If set to true auto versioning will also be applied if the cm:versionable aspect is applied.
  • autoVersionProps
    If set to true auto versioning of properties will also be applied, if the cm:versionable aspect is applied.

返回值

ScriptVersion

代码例

var version;
var createdDate;
var creator;

var node = companyhome.createFile("TEST_FILE_999.TXT");

node.ensureVersioningEnabled(true, true);

if (node.isVersioned){
    version = node.getVersion("1.0");
    createdDate = version.createdDate;
    creator = version.creator;
}
文档更新时间: 2019-07-04 20:18   作者:凌云文档