spo file remove
Removes the specified file
Usage
m365 spo file remove [options]
Alias
m365 spo page template remove
Options
-w, --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
idorurlbut not both-u, --url [url]The server- or site-relative URL of the file to remove. Specify either
idorurlbut not both--recycleRecycle the file instead of actually deleting it
--confirmDon'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 isfull.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Examples
Remove the file with ID 0cd891ef-afce-4e55-b836-fce03286cccf located in site https://contoso.sharepoint.com/sites/project-x
m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --id 0cd891ef-afce-4e55-b836-fce03286cccf
Remove the file with site-relative URL SharedDocuments/Test.docx from located in site https://contoso.sharepoint.com/sites/project-x
m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url SharedDocuments/Test.docx
Move the file with server-relative URL /sites/project-x/SharedDocuments/Test.docx located in site https://contoso.sharepoint.com/sites/project-x 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 the page template with site-relative URL SharedDocuments/Test.docx from located in site https://contoso.sharepoint.com/sites/project-x
m365 spo page template remove --webUrl https://contoso.sharepoint.com/sites/project-x --url SharedDocuments/Forms/Template.dotx