cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Version

arunakumarkumar
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

kavilash23
Champ on-the-rise
Champ on-the-rise
You need to call the save method for your changes to persist. You need something like the following after having updated the node properties
existingFile.save()