# Share With Community User

Explicitly share resources with Experience Cloud pages or with users/groups from Apex.

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

> **Method name** — The Archbee page is titled Share With Community User, but the underlying Apex method is shareResources(). Call it as cldfs.Client.shareResources(...).

## Signature

```apex
global static List<Attachment> shareResources(
  List<Types.ShareResourceInput> shareResourceInputs,
  String library,
  String runAs
)
```

### Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| shareResourceInputs | List&lt;<a href="#/apex-type-share-resource-input">Types.ShareResourceInput</a>&gt; | required | List of Types.ShareResourceInput entries, one per resource to share. |
| library | String | required | Type of library (example - sharepoint). You can get this value from the Content Library. |
| runAs | String | optional | runAs — usually a static value, integrationUser. |

## Return Type

List<Attachment&gt;

## Example

```apex
List<cldfs.Types.ShareResourceInput> shareResourceInputs = new List<cldfs.Types.ShareResourceInput> {
    new cldfs.Types.ShareResourceInput(
        '01KEHAKUXVID7NMSLZINGKUXGQ3SIT75CM',
        'file',
        '001dL00000Wonj3QAB',
        'b!nJBtPq_z5UeJtFrj_f24XEQqlPUD8vtFsg7GBcrXJepiUn9bkb_7QbDPtqHVD-cP'
    )
};
List<cldfs.Attachment> attachments = cldfs.Client.shareResources(
    shareResourceInputs,
    'sharepoint',
    'integrationUser'
);
```
