# Get Folder Contents

Get the contents of one or more folders stored in external systems like SharePoint or Google Drive.

> Kind: Apex method · Updated: 2026-07-01

## Signature

```apex
global static List<ResourceList> getFolderContents(
  List<Resource> folders,
  String sortBy,
  String sortOrder,
  String runAs,
  String contentType
)
```

### Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| folders | List&lt;<a href="#/apex-type-resource">Resource</a>&gt; | required | List of Resource objects representing the source folders. |
| sortBy | String | optional | Content field to sort by. For example, name for alphabetic sorting. |
| sortOrder | String | optional | Sort direction: ascending or descending. |
| runAs | String | optional | Email of the user to run the action on behalf of. Supply integrationuser to run as the automation user. |
| contentType | String | optional | Use null to return everything; use folder to return only folders. |

## Return Type

List<ResourceList&gt; — one ResourceList per source folder, each holding that folder's contents.

## Example

```apex
List<cldfs.Resource> folders = new List<cldfs.Resource>{
  new cldfs.Resource(
    '68887db5ef0b3ca7534dbbd5',
    'folder',
    'Leads',
    'cloudfiles',
    'workspace'
  )
};

List<cldfs.ResourceList> outputs = cldfs.Client.getFolderContents(
  folders,
  null,
  null,
  'integrationUser',
  null
);
```
