Skip to main content

spo file remove

Removes the specified file

Usage

m365 spo file remove [options]

Alias

m365 spo page template remove

Options

-u, --webUrl <webUrl>

URL of the site where the file to remove is located.

-i, --id [id]

The ID of the file to remove. Specify either id or url but not both.

--url [url]

The server- or site-relative decoded URL of the file to remove. Specify either id or url but not both.

--recycle

Recycle the file instead of actually deleting it.

-f, --force

Don't prompt for confirming removing the file.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Examples

Remove file by ID.

m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --id 0cd891ef-afce-4e55-b836-fce03286cccf

Remove the file by site-relative URL.

m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/Shared Documents/Test.docx"

Move the file by server-relative URL to the recycle bin.

m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/sites/project-x/SharedDocuments/Test.docx" --recycle

Remove a page template by site-relative URL.

m365 spo page template remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/Shared Documents/Forms/Template.dotx"

Response

The command won't return a response on success.

CTRL + M