Skip to content

spo listitem list

Gets a list of items from the specified list

Usage

spo listitem list [options]

Options

Option Description
--help output usage information
-u, --webUrl <webUrl> URL of the site from which the item should be retrieved
-i, --id <id> ID of the list to retrieve items from. Specify id or title but not both
-t, --title [listTitle] Title of the list from which to retrieve the item. Specify id or title but not both
-q, --query [camlQuery] CAML query to use to query the list of items with
-f, --fields [fields] Comma-separated list of fields to retrieve. Will retrieve all fields if not specified and json output is requested. Specify query or fields but not both
-l, --filter [odataFilter] OData filter to use to query the list of items with. Specify query or filter but not both
-p, --pageSize [pageSize] Number of list items to return. Specify query or pageSize but not both
-n, --pageNumber [pageNumber] Page number to return if pageSize is specified (first page is indexed as value of 0)
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Remarks

pageNumber is specified as a 0-based index. A value of 2 returns the third page of items.

Examples

Get all items from a list named Demo List

spo listitem list --title "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x

From a list named Demo List get all items with title Demo list item using a CAML query

spo listitem list --title "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x --query "<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Demo list item</Value></Eq></Where></Query></View>"

Get all items from a list with ID 935c13a0-cc53-4103-8b48-c1d0828eaa7f

spo listitem list --id 935c13a0-cc53-4103-8b48-c1d0828eaa7f --webUrl https://contoso.sharepoint.com/sites/project-x

Get all items from list named Demo List. For each item, retrieve the value of the ID, Title and Modified fields

spo listitem list --title "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x --fields "ID,Title,Modified"

From a list named Demo List get all items with title Demo list item using an OData filter

spo listitem list --title "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x --filter "Title eq 'Demo list item'"

From a list named Demo List get the second batch of 10 items

spo listitem list --title "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x --pageSize 10 --pageNumber 2