Usage
m365 spo file version remove [options]
Description
Removes a specific version of a file
Options
| Option |
Description |
-w, --webUrl <webUrl> |
The URL of the site where the file is located |
--label <label> |
Label of version which will be removed |
-u, --fileUrl [fileUrl] |
The server-relative URL of the file to retrieve. Specify either fileUrl or fileId but not both |
--fileId [fileId] |
The UniqueId (GUID) of the file to retrieve. Specify either fileUrl or fileId but not both |
--confirm |
When specified do not prompt for confirmation |
Examples
Removes file specified version from version history by file id
m365 spo file version remove --webUrl https://contoso.sharepoint.com/sites/project-x --label "0.1" --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'
Removes file specified version from version history by file url without confirmation
m365 spo file version remove --webUrl https://contoso.sharepoint.com/sites/project-x --label "0.1" --fileUrl '/sites/project-x/documents/Test1.docx' --confirm
Additional Info
we may reuse spo file get command with asListItem option to get the item id and then we may use the following to remove by label (endpoint fill with test data)
/_api/web/Lists/getbytitle('Documents')/items(18)/file/versions/DeleteByLabel('1.0')
Usage
m365 spo file version remove [options]
Description
Removes a specific version of a file
Options
-w, --webUrl <webUrl>--label <label>-u, --fileUrl [fileUrl]--fileId [fileId]--confirmExamples
Removes file specified version from version history by file id
Removes file specified version from version history by file url without confirmation
Additional Info
we may reuse
spo file getcommand withasListItemoption to get the item id and then we may use the following to remove by label (endpoint fill with test data)