Usage
m365 spo file version restore [options]
Description
Restores file to the specified version
Options
| Option |
Description |
-w, --webUrl <webUrl> |
The URL of the site where the file is located |
--label <label> |
Label of version which will be restored |
-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
Restores file specified version from version history by file id
m365 spo file version restore --webUrl https://contoso.sharepoint.com/sites/project-x --label "0.1" --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'
Restores file specified version from version history by file url without confirmation
m365 spo file version restore --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 restore
/site/_api/web/lists/getbyid(DocumentLibraryId)/Items(ItemId)/File/Versions/restoreByLabel(VersionLabel)
Usage
m365 spo file version restore [options]
Description
Restores file to the specified version
Options
-w, --webUrl <webUrl>--label <label>-u, --fileUrl [fileUrl]--fileId [fileId]--confirmExamples
Restores file specified version from version history by file id
Restores 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 restore