import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spe containertype add

Creates a new container type

## Usage

```sh
m365 spe containertype add [options]
```

## Options

```md definition-list
`-n, --name <name>`
: Container type name.

`--appId [appId]`
: Application ID of the Microsoft Entra ID app that will be the owner of the container type. By default, the current app is used.

`--billingType [billingType]`
: The billing type. The possible values are: `standard`, `trial`, `directToCustomer`, `unknownFutureValue`. The default value is `standard`.

`--consumingTenantOverridables [consumingTenantOverridables]`
: A comma-separated list of settings that can be overridden in the consuming tenant. The possible values are: `urlTemplate`, `isDiscoverabilityEnabled`, `isSearchEnabled`, `isItemVersioningEnabled`, `itemMajorVersionLimit`, `maxStoragePerContainerInBytes`.

`--isDiscoverabilityEnabled [isDiscoverabilityEnabled]`
: Indicates whether items from containers are surfaced in experiences such as My Activity or Microsoft 365. Valid values: `true`, `false`. The default value is `false`.

`--isItemVersioningEnabled [isItemVersioningEnabled]`
: Indicates whether item versioning is enabled for the container. Valid values: `true`, `false`. The default value is `true`.

`--itemMajorVersionLimit [itemMajorVersionLimit]`
: Maximum number of versions. `isItemVersioningEnabled` must be enabled. Default value is `500`.

`--isSearchEnabled [isSearchEnabled]`
: Indicates whether search is enabled. Valid values: `true`, `false`. The default value is `true`.

`--isSharingRestricted [isSharingRestricted]`
: Only the manager and owner can share files in the container if restricted sharing is enabled. Valid values: `true`, `false`. The default value is `false`.

`--maxStoragePerContainerInBytes [maxStoragePerContainerInBytes]`
: Controls maximum storage in bytes.

`--sharingCapability [sharingCapability]`
: Sharing capabilities permitted for containers. The possible values are: `disabled`, `externalUserSharingOnly`, `externalUserAndGuestSharing`, `existingExternalUserSharingOnly`.

`--urlTemplate [urlTemplate]`
: Pattern used to redirect files.
```

<Global />

## Remarks

:::warning

The command is based on an API that is currently in preview and is subject to change once the API reached general availability.

:::

:::note

The tenant must own the application that is assigned as the owner of the container type.

:::

:::note

You can only create **one** Trial container type per tenant, a single application registration can only contain **one** container type and a tenant can contain a maximum of **five** containers types in total.

:::

The registration of a container type in a newly created tenant can fail if the tenant isn't yet fully ready. You might need to wait at least an hour before you can register a container type in a new tenant.

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions                         |
  |-----------------|-------------------------------------|
  | Microsoft Graph | FileStorageContainerType.Manage.All |

  :::info

  To use this command you must be either **SharePoint Administrator** or **Global Administrator**.

  :::

  </TabItem>
  <TabItem value="Application">

  This command does not support application permissions.

  </TabItem>
</Tabs>

## Examples

Adds a new trial container type.

```sh
m365 spe containertype add --name 'trial container' --applicationId '1b3b8660-9a44-4a7c-9c02-657f3ff5d5ac' --billingType trial
```

Adds a new container type using a standard billing type for the current application.

```sh
m365 spe containertype add --name 'standard container'
```

Adds a new container type with additional settings

```sh
m365 spe containertype add --name 'Contoso container type' --appId 5181cccf-7a36-44c1-a00d-62581ca4d14a --billingType directToCustomer --consumingTenantOverridables "isDiscoverabilityEnabled, isSearchEnabled" --isDiscoverabilityEnabled true --isItemVersioningEnabled true --isSearchEnabled false --itemMajorVersionLimit 25 --isSharingRestricted true --maxStoragePerContainerInBytes 102030 --sharingCapability externalUserSharingOnly --urlTemplate "https://app.contoso.com/redirect?item={item-id}"
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  {
    "id": "ac8ac926-f924-4f89-bdc0-4e569c143a4d",
    "name": "Contoso container types",
    "owningAppId": "0e083c20-ad1c-4b45-93a6-6dd58fe4d694",
    "billingClassification": "trial",
    "billingStatus": "valid",
    "createdDateTime": "2025-08-28T06:13:12.0080609Z",
    "etag": "MC4wLjAuMA==",
    "settings": {
      "sharingCapability": "externalUserSharingOnly",
      "urlTemplate": "https://app.contoso.com/redirect?tenant={tenant-id}&drive={drive-id}&folder={folder-id}&item={item-id}",
      "isDiscoverabilityEnabled": false,
      "isSearchEnabled": true,
      "isItemVersioningEnabled": true,
      "itemMajorVersionLimit": 500,
      "maxStoragePerContainerInBytes": 27487790694400,
      "isSharingRestricted": false,
      "consumingTenantOverridables": "isSearchEnabled,itemMajorVersionLimit"
    }
  }
  ```

  </TabItem>
  <TabItem value="Text">

  ```text
  billingClassification: trial
  billingStatus        : valid
  createdDateTime      : 2025-08-28T06:13:12.0080609Z
  etag                 : MC4wLjAuMA==
  id                   : ac8ac926-f924-4f89-bdc0-4e569c143a4d
  name                 : Contoso container types
  owningAppId          : 0e083c20-ad1c-4b45-93a6-6dd58fe4d694
  settings             : {"sharingCapability":"externalUserSharingOnly","urlTemplate":"https://app.contoso.com/redirect?tenant={tenant-id}&drive={drive-id}&folder={folder-id}&item={item-id}","isDiscoverabilityEnabled":false,"isSearchEnabled":true,"isItemVersioningEnabled":true,"itemMajorVersionLimit":500,"maxStoragePerContainerInBytes":27487790694400,"isSharingRestricted":false,"consumingTenantOverridables":"isSearchEnabled,itemMajorVersionLimit"}
  ```

  </TabItem>
  <TabItem value="CSV">

  ```csv
  id,name,owningAppId,billingClassification,billingStatus,createdDateTime,etag
  ac8ac926-f924-4f89-bdc0-4e569c143a4d,Contoso container types,0e083c20-ad1c-4b45-93a6-6dd58fe4d694,trial,valid,2025-08-28T06:13:12.0080609Z,MC4wLjAuMA==
  ```

  </TabItem>
  <TabItem value="Markdown">

  ```md
  # spe containertype add --name "Contoso container types" --billingType "trial" --consumingTenantOverridables "isSearchEnabled,itemMajorVersionLimit" --sharingCapability "externalUserSharingOnly" --urlTemplate "https://app.contoso.com/redirect?tenant={tenant-id}&drive={drive-id}&folder={folder-id}&item={item-id}"

  Date: 28/08/2025

  ## Contoso container types (ac8ac926-f924-4f89-bdc0-4e569c143a4d)

  Property | Value
  ---------|-------
  id | ac8ac926-f924-4f89-bdc0-4e569c143a4d
  name | Contoso container types
  owningAppId | 0e083c20-ad1c-4b45-93a6-6dd58fe4d694
  billingClassification | trial
  billingStatus | valid
  createdDateTime | 2025-08-28T06:13:12.0080609Z
  etag | MC4wLjAuMA==
  ```

  </TabItem>
</Tabs>

## More information

In SharePoint Embedded, all files and documents are stored in Containers, and each Container is identified by a Container Type.

Container Type is a property stamped on every Container instance. Each Container Type is owned by one Application, and each Application can own only one Container Type.

The primary function of a Container Type is to manage the application workload that can access the Containers. Container Type defines the access permissions an Application has towards all Containers of that type, including create, read, write, delete containers; manage container permissions, etc.

More information about SharePoint Embedded and the limits can be found at the following location: [SharePoint Embedded](https://learn.microsoft.com/en-us/sharepoint/dev/embedded/concepts/app-concepts/containertypes#sharepoint-embedded-trial-container-types)
