Skip to main content

spo file list

Gets all files within the specified folder and site

Usage

m365 spo file list [options]

Options

-u, --webUrl <webUrl>

The URL of the site where the folder from which to retrieve files is located.

--folderUrl <folderUrl>

The server- or site-relative decoded URL of the parent folder from which to retrieve files.

--fields [fields]

Comma-separated list of fields to retrieve. Will retrieve all fields if not specified.

--filter [filter]

OData filter to use to query the list of items with.

-r, --recursive

Set to retrieve files from subfolders.

-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 options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

When the fields option includes values with a /, for example: ListItemAllFields/Id, an additional $expand query parameter will be included on ListItemAllFields.

Examples

Return all files from a folder.

m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents'

Return all files from a folder and all the sub-folders.

m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents' --recursive

Return the files from a folder with specific fields which will be expanded.

m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents' --fields "Title,Length"

Return the files from a folder that meet the criteria of the filter with specific fields which will be expanded.

m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents' --fields ListItemAllFields/Id --filter "Name eq 'document.docx'"

Response

[
{
"CheckInComment": "",
"CheckOutType": 2,
"ContentTag": "{F09C4EFE-B8C0-4E89-A166-03418661B89B},9,12",
"CustomizedPageStatus": 0,
"ETag": "\"{F09C4EFE-B8C0-4E89-A166-03418661B89B},9\"",
"Exists": true,
"IrmEnabled": false,
"Length": 331673,
"Level": 1,
"LinkingUri": "https://contoso.sharepoint.com/sites/project-x/Shared Documents/Document.docx?d=wf09c4efeb8c04e89a16603418661b89b",
"LinkingUrl": "https://contoso.sharepoint.com/sites/project-x/Shared Documents/Document.docx?d=wf09c4efeb8c04e89a16603418661b89b",
"MajorVersion": 3,
"MinorVersion": 0,
"Name": "Document.docx",
"ServerRelativeUrl": "/sites/project-x/Shared Documents/Document.docx",
"TimeCreated": "2018-02-05T08:42:36Z",
"TimeLastModified": "2018-02-05T08:44:03Z",
"Title": "",
"UIVersion": 1536,
"UIVersionLabel": "3.0",
"UniqueId": "f09c4efe-b8c0-4e89-a166-03418661b89b"
}
]
CTRL + M