# IRPCValueLists.CreateFolderTree

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Value lists](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/CreateFolderTree/

Badges: `Vault API / core` `write` `session or assertion` `returns metadata structure version`

Creates a tree of traditional folders under one anchor in one transaction: either every folder
is created or the call fails and nothing is saved.

- **Service:** [Value lists](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/index.md) `MFiles.IRPCValueLists`
- **gRPC method:** `/MFiles.IRPCValueLists/CreateFolderTree`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/create-folder-tree`
- **Request:** [`CreateFolderTreeRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/CreateFolderTree/index.md#request)
- **Response:** [`CreateFolderTreeResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/CreateFolderTree/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** write
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Not available in this version: the server fails the call with "Not implemented.". Use
  [CreateOrFindTraditionalFolder](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/CreateOrFindTraditionalFolder/index.md)
  for each folder instead.
- Requires the vault rights `license_allows_modifications` and `manage_traditional_folders`.

<a id="request"></a>

## Request: CreateFolderTreeRequest

Requests to create a tree of Traditional Folders under one anchor.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `anchor_type` | [`FolderTreeAnchorType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FolderTreeAnchorType/index.md) | Where the tree is attached. Values: `FOLDER_TREE_ANCHOR_TYPE_UNSPECIFIED` (0), `FOLDER_TREE_ANCHOR_TYPE_TRADITIONAL_ROOT` (1), `FOLDER_TREE_ANCHOR_TYPE_FOLDER` (2), `FOLDER_TREE_ANCHOR_TYPE_VIEW_LOCATION` (3). |
| `anchor_folder_id` | optional `int32` | The ID of the existing folder to create the tree in, as known to the client (the folder the user drops onto). Required for the folder anchor, not allowed for the others. Not the ID of any folder in the request: those are created by the server and returned in the response. |
| `view_location` | [`ViewLocation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ViewLocation/index.md) | The anchor view location. Required for the viewLocation anchor, not allowed for the others. |
| `view_location.parent_folder[]` | repeated [`Folder`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Folder/index.md) | Array of folders describing the parent folder of the view. The first element of the array must be a view folder. Other elements, if any, are property folders. |
| `view_location.parent_folder[].type` | [`FolderType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FolderType/index.md) | The type of the folder, for example `FOLDER_TYPE_VIEW_FOLDER` or `FOLDER_TYPE_PROPERTY_FOLDER`. Values: `FOLDER_TYPE_UNKNOWN` (0), `FOLDER_TYPE_ANY_FOLDER` (1), `FOLDER_TYPE_VIEW_FOLDER` (2), `FOLDER_TYPE_PROPERTY_FOLDER` (3), `FOLDER_TYPE_TRADITIONAL_FOLDER` (4), `FOLDER_TYPE_SEARCH_FOLDER` (5), `FOLDER_TYPE_EXTERNAL_VIEW_FOLDER` (6). |
| `view_location.parent_folder[].data` | [`FolderInfoUnion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FolderInfoUnion/index.md) | Additional folder type -specific information as a union. |
| `view_location.customizes_property_folder` | `bool` | True if the view is overlapping with a property folder. |
| `view_location.customized_property_folder` | [`TypedValue`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.TypedValue/index.md) | The overlapped property folder. Ignored if bOverlapping is false. |
| `view_location.customized_property_folder.is_null_value` | `bool` | True if the value is empty. `data` is then unset. |
| `view_location.customized_property_folder.type` | [`Datatype`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.Datatype/index.md) | The data type of the value. |
| `view_location.customized_property_folder.data` | [`TypedValueUnion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.TypedValueUnion/index.md) | The value, in the member that matches `type`. Unset for an empty value. |
| `nodes[]` | repeated [`FolderTreeNode`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FolderTreeNode/index.md) | The folders to create under the anchor, parents before children. |
| `nodes[].name` | `string` | The folder name. |
| `nodes[].parent_index` | `int32` | The index of the parent node in the list, or -1 for a top-level folder. Must be smaller than the node's own index (parents come first). |
| `rename_on_conflict` | `bool` | What to do when a folder name is used by a sibling: false fails the whole request, true gives the folder the name "<name> (n)". |

<a id="response"></a>

## Response: CreateFolderTreeResponse

Response to a create folder tree request. Always describes a fully created tree.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `nodes[]` | repeated [`FolderTreeNodeResult`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FolderTreeNodeResult/index.md) | One result per submitted folder, in the order of the request. |
| `nodes[].restored` | `bool` | True when a deleted same-named folder was restored, false when a new folder was created. |
| `nodes[].folder_id` | `int32` | The ID of the folder. |
| `nodes[].name` | `string` | The name actually used. |
| `nodes[].renamed` | `bool` | True when the rename policy changed the name. |
| `current_version_on_server` | `int64` | The current version of the Traditional Folders value list's data on the server. |

<a id="related"></a>

## Related methods

- [CreateOrFindTraditionalFolder](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCValueLists/CreateOrFindTraditionalFolder/index.md): Creates a traditional folder, or returns an existing folder with the same name.
