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

# planner bucket add

Adds a new Microsoft Planner bucket

## Usage

```sh
m365 planner bucket add [options]
```

## Options

```md definition-list
`-n, --name <name>`
: Name of the bucket to add.

`--planId [planId]`
: ID of the plan to which the bucket belongs. Specify either `planId`, `planTitle`, or `rosterId` but not multiple.

`--planTitle [planTitle]`
: Title of the plan to which the bucket belongs. Specify either `planId`, `planTitle`, or `rosterId` but not multiple.

`--rosterId [rosterId]`
: ID of the Planner Roster. Specify either `planId`, `planTitle`, or `rosterId` but not multiple.

`--ownerGroupId [ownerGroupId]`
: ID of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planTitle`.

`--ownerGroupName [ownerGroupName]`
: Name of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planTitle`.

`--orderHint [orderHint]`
: Hint used to order items of this type in a list view. The format is defined as outlined [here](https://learn.microsoft.com/graph/api/resources/planner-order-hint-format?view=graph-rest-1.0).
```

<Global />

## Remarks

:::warning

When using `rosterId`, the command is based on an API that is currently in preview and is subject to change once the API reached general availability.

:::

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions                           |
  |-----------------|---------------------------------------|
  | Microsoft Graph | Tasks.ReadWrite, GroupMember.Read.All |

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

  | Resource        | Permissions                               |
  |-----------------|-------------------------------------------|
  | Microsoft Graph | Tasks.ReadWrite.All, GroupMember.Read.All |

  </TabItem>
</Tabs>

## Examples

Adds a Microsoft Planner bucket for a plan based on its ID with an order hint

```sh
m365 planner bucket add --name "My Planner Bucket" --planId "xqQg5FS2LkCp935s-FIFm2QAFkHM" --orderHint " !"
```

Adds a Microsoft Planner bucket for a plan based on its title and owner group name

```sh
m365 planner bucket add --name "My Planner Bucket" --planTitle "My Planner Plan" --ownerGroupName "My Planner Group"
```

Adds a Microsoft Planner bucket for a plan based on its Planner Roster ID

```sh
m365 planner bucket add --name "My Planner Bucket" --rosterId "RuY-PSpdw02drevnYDTCJpgAEfoI"
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  {
    "name": "My Planner Bucket",
    "planId": "xqQg5FS2LkCp935s-FIFm2QAFkHM",
    "orderHint": "8585363889524958496",
    "id": "ttEB_Uj690STdR3GC1MIDZgANq1U"
  }
  ```

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

  ```text
  id       : ttEB_Uj690STdR3GC1MIDZgANq1U
  name     : My Planner Bucket
  orderHint: 8585363889524958496
  planId   : xqQg5FS2LkCp935s-FIFm2QAFkHM
  ```

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

  ```csv
  id,name,planId,orderHint
  ttEB_Uj690STdR3GC1MIDZgANq1U,My Planner Bucket,xqQg5FS2LkCp935s-FIFm2QAFkHM,8585363889524958496
  ```

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

  ```md
  # planner bucket add  --name "My Planner Bucket" --planId "xqQg5FS2LkCp935s-FIFm2QAFkHM"

  Date: 27/12/2022

  ## My Planner Bucket (ttEB_Uj690STdR3GC1MIDZgANq1U)

  Property | Value
  ---------|-------
  name | My Planner Bucket
  planId | xqQg5FS2LkCp935s-FIFm2QAFkHM
  orderHint | 8585363889524958496
  id | ttEB_Uj690STdR3GC1MIDZgANq1U
  ```

  </TabItem>
</Tabs>

