# Delete File/Folder

> `UiPath.MicrosoftOffice365.Activities.Files.DeleteItem`

`UiPath.MicrosoftOffice365.Activities.Files.DeleteItem`

## Description

Uses the Microsoft Graph [Delete item](https://docs.microsoft.com/en-us/graph/api/driveitem-delete?view=graph-rest-1.0&tabs=http) API to delete a specified file or folder in your OneDrive or SharePoint site (**DriveItem**).

### Scopes

This activity requires the following scopes:

* Sites.ReadWrite

OR

* Files.ReadWrite.All

OR

* Sites.ReadWrite.All

## Project compatibility

Windows - Legacy | Windows

## Configuration

#### In the body of the activity

* **File or folder to delete** - The `DriveItem` of the file or folder to delete. 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. 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., *myFiles(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**

* Check 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.

## 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)).
4. Add the **Delete File/Folder** activity inside the **Microsoft Office 365 Scope** activity.
5. Enter values for the Input properties.
6. Run the activity.
   * Your input property values are sent to the [DeleteDriveItem](https://docs.microsoft.com/en-us/graph/api/driveitem-delete?view=graph-rest-1.0&tabs=http) API.

![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-docs-image-187722-8a4a4a24.webp)
