You are here

ensureVersioningEnabled

ensureVersioningEnabled(autoVersion, autoVersionProps) ensures that this node has the cm:versionable aspect applied to it, and that it has the initial version in the version store.

Calling this on a versioned node with a version store entry will have no effect. Calling this on a newly uploaded share node will have versioning enabled for it.

Parameters

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.

Returns

ScriptVersion

Example

    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;
    }

      

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.