Skip to content

spo file version list

Retrieves all versions of a file

Usage

m365 spo file version list [options]

Options

-w, --webUrl <webUrl>
The URL of the site where the file is located
-u, --fileUrl [fileUrl]
The site-relative or server-relative URL of the file. Specify either fileUrl or fileId but not both
-i, --fileId [fileId]
The UniqueId (GUID) of the file. Specify either fileUrl or fileId but not both
-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 is full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv,md. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Examples

List file versions of a specific file based on the ID of the file

m365 spo file version list --webUrl https://contoso.sharepoint.com --fileId 'b2307a39-e878-458b-bc90-03bc578531d6'

List file versions of a specific file based on the site-relative URL of the file

m365 spo file version list --webUrl https://contoso.sharepoint.com --fileUrl '/Shared Documents/Document.docx'

List file versions of a specific file based on the server-relative URL of the file

m365 spo file version list --webUrl https://contoso.sharepoint.com/sites/project-x --fileUrl '/sites/project-x/Shared Documents/Document.docx'

Response

[
  {
    "CheckInComment": "",
    "Created": "2022-10-30T12:03:06Z",
    "ID": 512,
    "IsCurrentVersion": false,
    "Length": "18898",
    "Size": 18898,
    "Url": "_vti_history/512/Shared Documents/Document.docx",
    "VersionLabel": "1.0"
  }
]
Created               ID    IsCurrentVersion  VersionLabel
--------------------  ----  ----------------  ------------
2022-10-30T12:03:06Z  512   false             1.0
Created,ID,IsCurrentVersion,VersionLabel
2022-10-30T12:03:06Z,512,false,1.0