Skip to content

file list

Retrieves files from the specified folder and site

Usage

m365 file list [options]

Options

-u, --webUrl <webUrl>
The URL of the site where the folder from which to retrieve files is located
-f, --folderUrl <folderUrl>
The server- or site-relative URL of the folder from which to retrieve files
--recursive
Set to retrieve files from subfolders
-h, --help
output usage information
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text. Default text
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Remarks

This command is an improved version of the spo file list command. The main difference between the two commands is, that file list uses Microsoft Graph and properly supports retrieving files from large folders. Because file list uses Microsoft Graph and spo file list uses SharePoint REST APIs, the data returned by both commands is different.

Examples

Return all files from folder Shared Documents located in site https://contoso.sharepoint.com/sites/project-x

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

Return all files from the folder Shared Documents and all the sub-folders of Shared Documents located in site https://contoso.sharepoint.com/sites/project-x

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

Return all files from the Important folder in the Shared Documents document library located in site https://contoso.sharepoint.com/sites/project-x

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