Usage
m365 spo file version clear [options]
Description
Deletes all file version history
Options
| Option |
Description |
-w, --webUrl <webUrl> |
The URL of the site where the file is located |
-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
Clears file all version history by file id
m365 spo file version clear --webUrl https://contoso.sharepoint.com/sites/project-x --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'
Clears file all version history by file url without confirmation
m365 spo file version clear --webUrl https://contoso.sharepoint.com/sites/project-x --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 clear
/site/_api/web/lists/getbyid(DocumentLibraryId)/Items(ItemId)/File/versions/DeleteAll()
Usage
m365 spo file version clear [options]
Description
Deletes all file version history
Options
-w, --webUrl <webUrl>-u, --fileUrl [fileUrl]--fileId [fileId]--confirmExamples
Clears file all version history by file id
m365 spo file version clear --webUrl https://contoso.sharepoint.com/sites/project-x --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'Clears file all version history by file url without confirmation
m365 spo file version clear --webUrl https://contoso.sharepoint.com/sites/project-x --fileUrl '/sites/project-x/documents/Test1.docx' --confirmAdditional Info
we may reuse
spo file getcommand withasListItemoption to get the item id and then we may use the following to clear