Assets in collections

Avatar

Avatar

scottm8771198

Avatar

scottm8771198

scottm8771198

22-09-2019

I am trying to get all assets inside a  collection how to do that .

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Umesh_Sondhi

MVP

Avatar

Umesh_Sondhi

MVP

Umesh_Sondhi
MVP

23-09-2019

Resource Collection API will be used to retrieve the assets in a Collection. For reference

Resource resource = resourceResolver

            .getResource("yourpath");

    if (null != resource) {

        log.debug("resource path is {}", resource.getPath());

        ResourceCollection resourceCollection = resource.adaptTo(ResourceCollection.class);

        if (null != resourceCollection) {

            Iterator<Resource> resourceIterator = resourceCollection.getResources();

            while (resourceIterator.hasNext()) {

                Resource damResource = resourceIterator.next();

                log.debug("damResource path is {}", damResource.getPath());

                imagePaths.add(damResource.getPath());

            }

        }

    }

Answers (1)

Answers (1)

Avatar

Avatar

cal-netsolution

Avatar

cal-netsolution

cal-netsolution

23-09-2019

Hi Scott!

Please go through adobe helpx documentations.

Here is the link which expalins adding assets to a collection.

https://helpx.adobe.com/in/experience-manager/6-5/assets/using/managing-collections-touch-ui.html#Ad...

Best,

Cal