We are using Alfresco 3.4.2. I need to copy version documents to specific folder using webscript/API.Could you kindly suggest?
i tried crossRepoCopy function, but it is not letting me copy version files to this particular folder
Solved! Go to Solution.
I slightly remember a problem copying between stores way back in time. Since the "versions" of a document are stored in the "versionstore" your problem could be the same. Assuming you have an element v of a nodes node.versionHistory, your srcNode would be v.getNode() and targetFileName would be srcNode.name...
function copyAcrossStores(srcNode, targetFolderNode, targetFileName) {
var targetFileNode=targetFolderNode.createFile(targetFileName);
if (targetFileNode != null) {
//Alfresco 3: get content from source
targetFileNode.mimetype=srcNode.mimetype;
targetFileNode.content="emptyFile";
targetFileNode.save();
targetFileNode.properties.content.write(srcNode.properties.content);
}
return targetFileNode;
}
Maybe this snippet helps...
I slightly remember a problem copying between stores way back in time. Since the "versions" of a document are stored in the "versionstore" your problem could be the same. Assuming you have an element v of a nodes node.versionHistory, your srcNode would be v.getNode() and targetFileName would be srcNode.name...
function copyAcrossStores(srcNode, targetFolderNode, targetFileName) {
var targetFileNode=targetFolderNode.createFile(targetFileName);
if (targetFileNode != null) {
//Alfresco 3: get content from source
targetFileNode.mimetype=srcNode.mimetype;
targetFileNode.content="emptyFile";
targetFileNode.save();
targetFileNode.properties.content.write(srcNode.properties.content);
}
return targetFileNode;
}
Maybe this snippet helps...
Thanks ..its working
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.