03-16-2009 01:59 PM
//////////////////////////////////////////////////////
// File Name: move_version.js
//
// Purpose : Move a file from a folder to a target
// folder (which is parent folder). If file already exists
// in target folder it uses versioning to replace file
// and increase version number.
//
// Author: Julien Bonjean (julien@bonjean.info)
//
// Creation Date: 2009-02-10
// Last Modified: 2009-02-10 16:26:10 -0500
//////////////////////////////////////////////////////
var sourceFile = document;
var sourceFolder = document.parent;
var targetFolder = space.parent;
var targetFile = targetFolder.childByNamePath(document.name);
if(targetFile == null)
{
sourceFile.move(targetFolder);
}
else
{
var targetFileWorkingCopy = targetFile.checkout();
targetFileWorkingCopy.content = sourceFile.content;
targetFile = targetFileWorkingCopy.checkin();
sourceFile.remove();
}
03-19-2009 06:29 PM
//////////////////////////////////////////////////////
// File Name: move_version.js
//
// Purpose : Move a file from a folder to a target
// folder (which is parent folder). If file already exists
// in target folder it uses versioning to replace file
// and increase version number.
//
// Author: Julien Bonjean (julien.bonjean@savoirfairelinux.com)
//
// Creation Date: 2009-02-10
// Last Modified: 2009-02-18 16:26:10 -0500
//////////////////////////////////////////////////////
var sourceFile = document;
var sourceFolder = document.parent;
var targetFolder = space.parent;
var targetFile = targetFolder.childByNamePath(document.name);
if(targetFile == null && targetFile.hasPermission('WriteContent'))
{
sourceFile.move(targetFolder);
}
else
{
var targetFileWorkingCopy = targetFile.checkout();
var content = sourceFile.properties['content'];
targetFileWorkingCopy.properties['content'].write(content);
targetFileWorkingCopy.checkin("",false);
sourceFile.remove();
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.