Groovy script to create contribution folders | Community
Skip to main content
Adobe Champion
June 13, 2023
Solved

Groovy script to create contribution folders

  • June 13, 2023
  • 1 reply
  • 1317 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Himanshu_Singhal

@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-with-the-dam/m-p/194586

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

1 reply

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 13, 2023

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
P_V_NairAdobe ChampionAuthor
Adobe Champion
June 13, 2023

@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.

Himanshu_Singhal
Community Advisor
Himanshu_SinghalCommunity AdvisorAccepted solution
Community Advisor
June 14, 2023

@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-with-the-dam/m-p/194586

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