Skip to content

New command: spo file version get #3954

@Adam-it

Description

@Adam-it

Usage

m365 spo file version get [options]

Description

Retrieves specified version of a file from version history

Options

Option Description
-w, --webUrl <webUrl> The URL of the site where the file is located
--label <label> Label of version which will be retrieved
-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

Examples

Lists file specified version from version history by id

m365 spo file version get --webUrl https://contoso.sharepoint.com/sites/project-x --label "0.1" --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'

Lists file specified version from version history by url

m365 spo file version get --webUrl https://contoso.sharepoint.com/sites/project-x  --label "0.1" --fileUrl '/sites/project-x/documents/Test1.docx'

Additional Info

we may reuse spo file get command with asListItem option to get the item id and then we may use this endpoint to achieve this (filled with sample data)

/_api/web/Lists/getbytitle('Documents')/items(18)/versions/?$filter=VersionLabel eq '1.0'&$top=1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions