# Client.createFolders()

Create one or more folders from Apex.

> Kind: Apex method · Updated: Apr 2, 2026

## Signature

```apex
global static List<Resource> createFolders(
  List<Types.CreateFolderInput> inputs,
  String libraryId,
  String runAs
)
```

### Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| inputs | List<Types.CreateFolderInput> | required | One entry per folder. See Types.CreateFolderInput. |
| libraryId | String | required | Target storage library. Provider rules match the flow action — see Create Folder destination table. |
| runAs | String | optional | Username to attribute the operation to; defaults to the integration user. |

## Returns

List<Resource&gt; in input order. Failures throw CloudFilesException — partial success is not silent.

## Example

```apex
List<Types.CreateFolderInput> inputs =
  new List<Types.CreateFolderInput>{
    new Types.CreateFolderInput('Contracts', parentId),
    new Types.CreateFolderInput('Invoices',  parentId)
  };
List<Resource> created =
  Client.createFolders(inputs, 'sharepoint_a8x2', null);
System.assertEquals(2, created.size());
```

> **Testing** — Use ClientFactory with default mock values to get coverage without callouts.
