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

# flow list

Lists Power Automate flows in the given environment

## Usage

```sh
m365 flow list [options]
```

## Options

```md definition-list
`-e, --environmentName <environmentName>`
: The name of the environment for which to retrieve available flows.

`--sharingStatus [sharingStatus]`
: List a specific type of flows. Valid values: `ownedByMe`, `personal`, `sharedWithMe`, `all`. Defaults to `ownedByMe`. Don't specify this option when using asAdmin.

`--withSolutions`
: Include flows from solutions.

`--asAdmin`
: Set, to list all Flows as admin. Otherwise will return only your own flows.
```

<Global />

## Remarks

:::warning

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

:::

If the environment with the name you specified doesn't exist, you will get the `Access to the environment 'xyz' is denied.` error.

When you specify a value for `sharingStatus`, consider the following:

- `ownedByMe` returns all flows created by you regardless of whether they are shared or not.
- `personal` returns all flows created by you which are not shared.
- `sharedWithMe` returns flows that are shared with you, or created by you and shared with someone.
- `all` combines `personal` and `sharedWithMe`.

## Examples

List all your flows in the given environment.

```sh
m365 flow list --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5
```

List all flows in the given environment.

```sh
m365 flow list --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --asAdmin
```

List all flows that are shared with the current user.

```sh
m365 flow list --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --sharingStatus sharedWithMe
```

List all personal flows and include flows from solutions.

```sh
m365 flow list --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --sharingStatus personal --withSolutions
```

## Response

### Standard response

<Tabs>
  <TabItem value="JSON">

  ```json
  [
    {
      "name": "fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d",
      "id": "/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d",
      "type": "Microsoft.ProcessSimple/environments/flows",
      "properties": {
        "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",
        "displayName": "Invoicing flow",
        "userType": "Owner",
        "state": "Started",
        "connectionReferences": {
          "shared_office365": {
            "connectionName": "shared-office365-19528cc4-23c1-4b39-abea-f010eb9fe3f9",
            "source": "Embedded",
            "id": "/providers/Microsoft.PowerApps/apis/shared_office365",
            "displayName": "Office 365 Outlook",
            "iconUri": "https://connectoricons-prod.azureedge.net/releases/v1.0.1686/1.0.1686.3706/office365/icon.png",
            "brandColor": "#0078D4",
            "tier": "Standard"
          }
        },
        "createdTime": "2024-07-09T21:32:14.5918501Z",
        "lastModifiedTime": "2024-07-09T21:32:15.2349507Z",
        "environment": {
          "name": "Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4",
          "type": "Microsoft.ProcessSimple/environments",
          "id": "/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4"
        },
        "definitionSummary": {
          "triggers": [
            {
              "type": "Recurrence",
              "metadata": {
                "operationMetadataId": "57317efe-4f87-47bc-b69c-179452c75f87"
              }
            }
          ],
          "actions": [
            {
              "type": "OpenApiConnection",
              "swaggerOperationId": "SendEmailV2",
              "metadata": {
                "operationMetadataId": "474e8016-6a45-466a-a021-3fedf5a766be"
              }
            }
          ]
        },
        "creator": {
          "tenantId": "1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4",
          "objectId": "9723d9b0-b8d6-48af-b381-fb4a9f0403e4",
          "userId": "9723d9b0-b8d6-48af-b381-fb4a9f0403e4",
          "userType": "ActiveDirectory"
        },
        "provisioningMethod": "FromDefinition",
        "flowFailureAlertSubscribed": true,
        "isManaged": false
      }
    }
  ]
  ```

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

  ```text
  name                                  displayName
  ------------------------------------  --------------
  fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d  Invoicing Flow
  ```

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

  ```csv
  name,id,type,displayName
  fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d,/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d,Microsoft.ProcessSimple/environments/flows,Invoicing flow
  ```

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

  ```md
  # flow list --environmentName "Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4"

  Date: 09/07/2024

  ## Invoicing flow (/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d)

  Property | Value
  ---------|-------
  name | fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d
  id | /providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d
  type | Microsoft.ProcessSimple/environments/flows
  displayName | Invoicing flow
  ```

  </TabItem>
</Tabs>

### `asAdmin` response

<Tabs>
  <TabItem value="JSON">

  ```json
  [
    {
      "name": "fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d",
      "id": "/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d",
      "type": "Microsoft.ProcessSimple/environments/flows",
      "properties": {
        "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",
        "displayName": "Invoicing flow",
        "state": "Started",
        "createdTime": "2024-07-09T21:32:15Z",
        "lastModifiedTime": "2024-07-09T21:32:15Z",
        "flowSuspensionReason": "None",
        "environment": {
          "name": "Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4",
          "type": "Microsoft.ProcessSimple/environments",
          "id": "/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4"
        },
        "definitionSummary": {
          "triggers": [],
          "actions": []
        },
        "creator": {
          "tenantId": "1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4",
          "objectId": "9723d9b0-b8d6-48af-b381-fb4a9f0403e4",
          "userId": "9723d9b0-b8d6-48af-b381-fb4a9f0403e4",
          "userType": "ActiveDirectory"
        },
        "flowFailureAlertSubscribed": false,
        "isManaged": false,
        "machineDescriptionData": {},
        "flowOpenAiData": {
          "isConsequential": false,
          "isConsequentialFlagOverwritten": false
        }
      }
    }
  ]
  ```

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

  ```text
  name                                  displayName
  ------------------------------------  --------------
  fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d  Invoicing Flow
  ```

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

  ```csv
  name,id,type,displayName
  fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d,/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d,Microsoft.ProcessSimple/environments/flows,Invoicing flow
  ```

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

  ```md
  # flow list --environmentName "Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4"

  Date: 09/07/2024

  ## Invoicing flow (/providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d)

  Property | Value
  ---------|-------
  name | fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d
  id | /providers/Microsoft.ProcessSimple/environments/Default-1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4/flows/fc2d4ef5-4151-4e93-9aaa-1f380d7ed95d
  type | Microsoft.ProcessSimple/environments/flows
  displayName | Invoicing flow
  ```

  </TabItem>
</Tabs>
