SharePoint — Get list items
SharePoint — Get list items
Section titled “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).
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
list | string | — | Display name or ID of the list. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
maxResults | int | 100 | Maximum number of items. Non-numeric, 0 or negative values use 100. |
Output
Section titled “Output”Returns a List<Dictionary<string,object>>. Each item has two keys:
| Key | Content |
|---|---|
id | Item ID (text, for example "12"). Use it in Update or Delete list item. |
fields | Dictionary 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.
Common errors
Section titled “Common errors”| Message | Cause 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. |
Example
Section titled “Example”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" }Related activities
Section titled “Related activities”- SharePoint — Add list item — add an item.
- SharePoint — Update list item — change an item.
- SharePoint — Delete list item — delete an item.
- All OneDrive / SharePoint activities