---
title: "insertFolder"
slug: "api/basket/operations/insertfolder"
sidebar:
  order: 432
---

<a id="ref-9f02207d38d3"></a>
<a id="ref-d131900de439"></a>
<a id="ref-73b76fccb259"></a>

## Synopsis

```text
BItemId insertFolder(SessionId sessionId,
    BItemId fatherId,
    BItemId beforeId,
    DisplayText name)
throws BasketServiceFault;
```

See also: [BItemId](/pCon/configuratorOnline/specs/api/basket/types/bitemid#ref-bccb6c926e5b), [SessionId](/pCon/configuratorOnline/specs/api/session/types/sessionid#ref-02e397c8fdb4), [`DisplayText`](/pCon/configuratorOnline/specs/api/basket/types/displaytext-basket#ref-b19f0939e15a), [BasketServiceFault](/pCon/configuratorOnline/specs/api/basket/faults/basketservicefault#ref-d5adb74faa1b)

The `insertFolder` operation inserts a new folder item into the basket item tree maintained by the basket service for the session identified by the `sessionId` parameter. It returns the item ID of the inserted folder.

The `fatherId` parameter, if not the null-UUID, must identify the basket item that will become the parent of the new OFML article item. If `fatherId` is the null-UUID (§[UUID](/pCon/configuratorOnline/specs/guide/web-service-interfaces/common-type-definitions/uuid#ref-2a898bc98aaf)), the root item of the basket item tree will be used as the parent item.

The `beforeId` parameter, if not the null-UUID, must identify an existing basket item. If this item is a descendant of the basket item that has been selected as the parent of the newly inserted item, then the new item will be inserted in front of the parent’s child which is either equal to the item identified by `beforeId`, or an ancestor of this item. Otherwise (if `beforeId` is a null-UUID, or if the basket item identified by `beforeId` is not a descendant of the parent item) the new item will be inserted as the last child of the parent item.

The parameter `name` should contain the name of the folder.

The inserted basket item is of type `Folder` (§[BasketItemType](/pCon/configuratorOnline/specs/api/basket/types/basketitemtype#ref-5d3667cadff0)). Additional properties of the newly inserted folder item may be set using the `setItemProperties` operation (§[setItemProperties](/pCon/configuratorOnline/specs/api/basket/operations/setitemproperties#ref-34e417ae27ba)).

A [`BasketServiceFault`](/pCon/configuratorOnline/specs/api/basket/faults/basketservicefault) is returned if any of the following conditions occurs:

- The `sessionId` parameter is not a valid string representation of an UUID or does not represent an open session.

- Either the `fatherId` or `beforeId` parameter does not represent an UUID.

- Either the `fatherId` or `beforeId` parameter does not identify a basket item and is not the null-UUID.

- The basket item identified by the `fatherId` parameter does not permit child items of type `Folder`.

- There was some error during the actual process of inserting the folder item.
