# Create Folder

> `UiPath.MicrosoftOffice365.Activities.Files.CreateFolder`

`UiPath.MicrosoftOffice365.Activities.Files.CreateFolder`

## Description

Uses the Microsoft Graph [Create folder](https://docs.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http) API to create a new folder (**FolderName**) in a specified parent directory (**Destination folder**).

After the folder is created, the activity returns a `DriveItem` object (**Folder**) that you can use as an input variable in subsequent activities.

### Scopes

This activity requires the following scopes:

* Sites.ReadWrite.All

## Project compatibility

Windows - Legacy | Windows

## Configuring the activity

#### In the body of the activity

* **Folder name** - A name for the created folder. This property supports `String` variables and string formatted values.
* **Destination folder** - The `DriveItem` of the directory in which this folder is created. This object can be retrieved using the [Find Files And Folders](https://docs.uipath.com/activities/other/latest/productivity/office365-find-files-and-folders) activity. If you want to create a folder in the root of your drive, leave this property empty. If you want to specify a location other than the root of your drive, use the output property variable from the **Find Files and Folders** (**First** or **Results**). If you're using the **Results** output property from the **Find Files and Folders** activity, specify the item in the array that you want to use (e.g., *myFolders(0)*).

:::note
You can save files or folders for later use in the automation using the [Get File/Folder](https://docs.uipath.com/activities/other/latest/productivity/office365-get-item-info) activity.
:::

#### Properties panel

**Common**

* **DisplayName** - The display name of the activity in the Designer panel. This property supports `String` variables and string formatted values.

#### Input

* See the options in the body of the activity.

#### Misc

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level. This field supports Boolean values.

#### Options

* **Account** - The ID or User Principal Name for the user who owns the OneDrive. This parameter must be set for **ApplicationIDandSecret** and **ApplicationIDAndCertificate** authentication types.

#### Output

**Reference as** - The name used to refer to this folder in other activities.

## How it works

The following steps and message sequence diagram is an example of how the activity works from design time (i.e., the activity dependencies and input/output properties) to run time.

1. Complete the steps.
2. Add the [Microsoft Office 365 Scope](https://docs.uipath.com/activities/other/latest/productivity/microsoft-office-365-scope) activity to your project.
3. Add an activity or run an external process that outputs a `DriveItem` object (e.g., [Find Files and Folders](https://docs.uipath.com/activities/other/latest/productivity/office365-find-files-and-folders), [Create Workbook](https://docs.uipath.com/activities/other/latest/productivity/office365-create-workbook), [Copy File/Folder](https://docs.uipath.com/activities/other/latest/productivity/office365-copy-item)).
4. Add the **Create Folder** activity inside the **Microsoft Office 365 Scope** activity.
5. Enter values for the Input properties.
6. Create and enter a `DriveItem` variable for the Output property.
7. Run the activity.
   * Your input property values are sent to the [CreateFolder](https://docs.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http) API.
   * The API returns the `DriveItem` value to your output property variable.
