Expand my Community achievements bar.

SOLVED

Groovy script to create contribution folders

Avatar

Adobe Champion

Hi All,

 

I have a requirement to create 1300 folders in one go.

 

I found that ACS Commons Asset folder creator can be used to create the folders in one go. But my requirement is to create all these folders as contribution folders for sharing in brand portal.

 

How can I achieve this after folder creation using ACS Commons feature?

 

Regards,

Priya

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@P_V_Nair If you don't want to use groovy specific syntax while writing script, you can standard sling API as well that we use in Java. 
Use ModifiableMap to set properties in resource or use AssetManager api if that fills the requirement. 
E.g. as mentioned here -> https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/programatically-working-wi...

Simply write the Sling java api code in groovy and that will work. 

View solution in original post

3 Replies

Avatar

Community Advisor

I don't think you can use the ACS Commons Asset Folder Creator to create contribution folders, instead as you suggested, you could use a Groovy script which will create the folders and then will add the necessary information to make them contribution folders. 

Here are excellent examples of how to use Groovy scripts: 



Esteban Bustamante

Avatar

Adobe Champion

@EstebanBustamante  Do you know any sample groovy scripts or sample on how to create contribution folder programatically? I hope contribution folders configuration is different from normal folders.

Avatar

Correct answer by
Community Advisor

@P_V_Nair If you don't want to use groovy specific syntax while writing script, you can standard sling API as well that we use in Java. 
Use ModifiableMap to set properties in resource or use AssetManager api if that fills the requirement. 
E.g. as mentioned here -> https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/programatically-working-wi...

Simply write the Sling java api code in groovy and that will work.