Quantcast
Channel: Alfresco Forums - Alfresco API
Viewing all articles
Browse latest Browse all 252

Auto Version

$
0
0

I have to control versioning while updating the content but i could not able to reach. I tired in the following approach but it is not working me. Can anyone tel me how do achieve ?

1)var existingFile = destNode.childByNamePath(filename);
if (existingFile !== null)
{
// File already exists, decide what to do
if (existingFile.hasAspect("cm:versionable") && overwrite)
{

existingFile.properties["cm:autoVersionOnUpdateProps"]=false;
existingFile.properties["cm:autoversion"]=false;
existingFile.ensureVersioningEnabled(false, false);
// Upload component was configured to overwrite files if name clashes
existingFile.properties.content.write(content,false,true);

// Extract the metadata
// (The overwrite policy controls which if any parts of
// the document's properties are updated from this)
extractMetadata(existingFile);

// Record the file details ready for generating the response
model.document = existingFile;

return;
}

2) If i add sys:temporary aspect i can able to controll but it is deleting from archive

Thanks,
Aruna


Viewing all articles
Browse latest Browse all 252

Trending Articles