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

# planner task reference add

Adds a new reference to a Planner task.

## Usage

```sh
m365 planner task reference add [options]
```

## Options

```md definition-list
`-i, --taskId <taskId>`
: ID of the task.

`-u, --url <url>`
: URL location of the reference.

`--alias [alias]`
: A name alias to describe the reference.

`--type [type]`
: Used to describe the type of the reference. Types include: `PowerPoint`, `Word`, `Excel`, `Other`.
```

<Global />

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions     |
  |-----------------|-----------------|
  | Microsoft Graph | Tasks.ReadWrite |

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

  | Resource        | Permissions         |
  |-----------------|---------------------|
  | Microsoft Graph | Tasks.ReadWrite.All |

  </TabItem>
</Tabs>

## Examples

Add a new reference with the url _https://www.microsoft.com_ to a Planner task with the id _2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2_

```sh
m365 planner task reference add --taskId "2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2" --url "https://www.microsoft.com"
```

Add a new reference with the url _https://www.microsoft.com_ and with the alias _Parker_ to a Planner task with the id _2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2_

```sh
m365 planner task reference add --taskId "2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2" --url "https://www.microsoft.com" --alias "Parker"
```

Add a new reference with the url _https://www.microsoft.com_ and with the type Excel to a Planner task with the id _2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2_

```sh
m365 planner task reference add --taskId "2Vf8JHgsBUiIf-nuvBtv-ZgAAYw2" --url "https://www.microsoft.com" --type "Excel"
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  {
    "https%3A//microsoft%2Ecom": {
      "alias": null,
      "type": null,
      "previewPriority": "8585269190192498871PB",
      "lastModifiedDateTime": "2023-01-25T23:05:26.24332Z",
      "lastModifiedBy": {
        "user": {
          "displayName": null,
          "id": "b2091e18-7882-4efe-b7d1-90703f5a5c65"
        }
      }
    }
  }
  ```

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

  ```txt
  https%3A//microsoft%2Ecom: {"alias":null,"type":null,"previewPriority":"8585269190192498871PB","lastModifiedDateTime":"2023-01-25T23:05:26.24332Z","lastModifiedBy":{"user":{"displayName":null,"id":"b2091e18-7882-4efe-b7d1-90703f5a5c65"}}}
  ```

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

  ```csv
  https%3A//microsoft%2Ecom
  "{""alias"":null,""type"":null,""previewPriority"":""8585269190192498871PB"",""lastModifiedDateTime"":""2023-01-25T23:05:26.24332Z"",""lastModifiedBy"":{""user"":{""displayName"":null,""id"":""b2091e18-7882-4efe-b7d1-90703f5a5c65""}}}"
  ```

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

  ```md
  # planner task reference add --taskId "OopX1ANphEu7Lm4-0tVtl5cAFRGQ" --url "https://microsoft.com"

  Date: 4/2/2023

  Property | Value
  ---------|-------
  ```

  </TabItem>
</Tabs>
