Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

how to create imageset and add assets through java API in AEM 6.4

Avatar

Level 1

I have created a program with the following code:

ResourceResolver resourceResolver = resolverFactory.getResourceResolver(Collections.singletonMap("user.jcr.session", (Object) adminSession)); 

Resource damResource = resourceResolver.resolve("/content/dam/images");

ImageSet imageset = S7SetHelper.createS7ImageSet(damResource, "ImageSet", null);

Through this code, i am able to create an imageset.

Now, I want to add assets to this imageset. So, I wrote this code:

Asset asset = resourceResolver.getResource("/content/dam/images/Cycling.jpeg").adaptTo(Asset.class);

imageset.add(asset);

But this code is not working. Can anyone help with how to add assets to the imageset created.

0 Replies