SharePoint — Add list item
SharePoint — Add list item
Section titled “SharePoint — Add list item”Type: msfiles-add-list-item · Package: OneDrive / SharePoint v1.0.5 · Output: string
Adds a new item to a SharePoint list, with the values of its columns. It is an easy way to record results where the team already works, with SharePoint views, filters and alerts.
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.
The internal name is set when the column is created and does not change if you rename it: a column created as “Payment date” usually has the internal name Payment_x0020_date. To see it, open the column settings in SharePoint (it shows in the address as Field=) or read an item with Get list items and look at the fields keys.
Column values:
- Text, number, yes/no and choice: the value as is (
"Pending",1500,true). - Date: ISO 8601 text (
"2026-10-15T00:00:00Z"). - Person or lookup: the related item’s ID in
<Column>LookupId("OwnerLookupId": 7). nullvalues are skipped.
Each run creates a new item; it does not check whether an identical one exists. If you retry after an error, check with Get list items first to avoid duplicates.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
list | string | — | Display name or ID of the list. |
fields | Dictionary | — | Column values as { column: value }, with internal names. Must have at least one non-null value. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
Output
Section titled “Output”Returns a string with the ID of the created item (for example "42"). Keep it if you will update or delete the item later.
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. |
'fields' is required. | fields is empty, all its values are null or it is not a dictionary. |
invalidRequest (Microsoft Graph, 400) | A column does not exist with that internal name, or a value does not have the format the column expects (date, number, invalid choice). |
itemNotFound (Microsoft Graph, 404) | There is no list with that name or ID in the site. |
accessDenied (Microsoft Graph, 403) | The connection is missing Sites.ReadWrite.All or the account cannot add items to the list. |
Example
Section titled “Example”OneDrive/SharePoint — Connect credential = credential("m365-operations") siteId = siteId └─ body: SharePoint — Add list item list = "Requests" fields = { "Title": "Invoice " + invoiceNumber, "Status": "Pending", "Amount": total } → output: newId Log message = "Request created with ID " + newIdRelated activities
Section titled “Related activities”- SharePoint — Get list items — read the list items.
- SharePoint — Update list item — change an item.
- SharePoint — Delete list item — delete an item.
- All OneDrive / SharePoint activities