Skip to content

SharePoint — Get list items

Type: msfiles-get-list-items  ·  Package: OneDrive / SharePoint v1.0.5  ·  Output: List<Dictionary<string,object>>

Reads the items of a SharePoint list along with their fields. SharePoint lists work like tables; use it to treat a list as a data source for your process (requests, inventories, records).

It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter, or place this activity inside the body of Connect to inherit it automatically.

It returns at most maxResults items, from a single page of Microsoft Graph results, in the order SharePoint delivers them (usually creation order). It does not filter: if you only need some items, filter them afterwards in the process. It is read-only.

ParameterTypeDefaultDescription
liststring—Display name or ID of the list.
ParameterTypeDefaultDescription
sessionZoanMicrosoftFilesSession—Connect session. Inherited inside Connect’s body.
maxResultsint100Maximum number of items. Non-numeric, 0 or negative values use 100.

Returns a List<Dictionary<string,object>>. Each item has two keys:

KeyContent
idItem ID (text, for example "12"). Use it in Update or Delete list item.
fieldsDictionary with the columns by internal name: Title, your own columns and system columns (Created, Modified, AuthorLookupId…).

Access a column with item["fields"]["Title"]. Values arrive as text, number or boolean; dates as ISO 8601 text in UTC; person or lookup columns as the related item’s ID in <Column>LookupId. Empty columns may be missing from fields: if a column is optional, check that it exists before reading it.

If the list is empty, it returns an empty list.

MessageCause and fix
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically.The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = session.
This activity needs a SharePoint site. Set 'siteId' in the Connect activity.Connect was opened without siteId.
'list' is required.list is empty or its expression returned null.
itemNotFound (Microsoft Graph, 404)There is no list with that name or ID in the site, or the siteId is not valid.
accessDenied (Microsoft Graph, 403)The connection is missing Sites.Read.All / Sites.ReadWrite.All, or the account has no access to the list.
OneDrive/SharePoint — Connect credential = credential("m365-operations") siteId = siteId
└─ body:
SharePoint — Get list items list = "Requests" maxResults = 500 → output: requests
For each r in requests
└─ If condition = r["fields"]["Status"].ToString() == "Pending"
└─ then:
SharePoint — Update list item list = "Requests" itemId = r["id"] fields = { "Status": "In progress" }