# Get Shared Resources

List the files and folders shared with community users on one or more Salesforce records, from Apex.

> Kind: Apex method · Updated: 2026-10-05

## Signature

```apex
global static List<List<Attachment>> getSharedResources(
  List<String> parentIds,
  String runAs
)
```

### Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| parentIds | List&lt;String&gt; | required | The Salesforce record Ids to list shared resources for. |
| runAs | String | optional | Email Id of the user on whose behalf the function should run. To run the action as the automation user, supply integrationUser. |

## Return Type

List<List<Attachment&gt;&gt;. One list per record Id, in the same order as parentIds. Each list holds the resources on that record that are shared with community users.

## Example

```apex
List<String> parentIds = new List<String>{ '001dL00000a1B2cQAE' };

List<List<cldfs.Attachment>> shared = cldfs.Client.getSharedResources(parentIds, 'integrationUser');
for (cldfs.Attachment attachment : shared[0]) {
  System.debug(attachment);
}
```

> **Shared resources and attachments** — This method lists only the resources on each record that are shared with community users, for example through Share with Community User. To list every resource attached to a record, shared or not, use Get Attachments.

> **Testing** — Use ClientFactory with default mock values to get coverage without callouts. See How to get test coverage of code that uses Client methods.
