Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AssetManager copyAsset method to create version if destination already exist

Avatar

Level 3

Hi,

How I can use copyAsset method to create new version of an asset if  destination asset already exist.

Thanks
LM

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor
2 Replies

Avatar

Level 10

Look at this community article:

https://helpx.adobe.com/experience-manager/using/graniteAPI.html

It talks about using the Granite version of AssetManager to move digital assets. Its up to your app logic to name the asset when you move it. For example:

 String assetPath = "/content/dam/testfolder/somefile.pdf";
 String copyPath = "/content/dam/testhtml/copieddoc.pdf";
 assetManager.copyAsset(assetPath, copyPath);

You can check to see if a asset has the name. If so - change the name of the new asset - ie - copieddoc1.pdf.

Avatar

Correct answer by
Employee Advisor

You can use the AssetManager-API to create revisions[1].

kind regards,
Jörg

 

[1] https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/api/AssetManager.html#createRevision(...)