An API that connects multiple Microsoft services, enabling data access and automation across platforms
Creating a list item inside a folder of a custom (non-document-library) SharePoint list is not supported via the Microsoft Graph listItem APIs in the same way that moving driveItems between folders is supported in document libraries.
The behavior observed is expected:
-
POST /sites/{site-id}/lists/{list-id}/itemsalways creates the item at the root of the list. - Updating
parentReferenceon a listItem does not move it into a folder. - The
parentReferencemove pattern shown in Microsoft Graph applies todriveItemresources (files/folders in drives), not to list items in custom lists.
The move semantics demonstrated in Graph are for driveItem:
PATCH https://graph.microsoft.com/v1.0/me/drive/items/{item-id}
Content-type: application/json
{
"parentReference": {
"id": "{new-parent-folder-id}"
},
"name": "new-item-name.txt"
}
and in JavaScript:
const driveItem = {
parentReference: {
id: '{new-parent-folder-id}'
},
name: 'new-item-name.txt'
};
await client.api('/me/drive/items/{item-id}').update(driveItem);
These examples apply to OneDrive/SharePoint document libraries (drives), not to custom list items.
For custom lists that use folders, Microsoft Graph documentation in the provided context only covers:
- Creating list items at the list root:
POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items Content-Type: application/json { "fields": { "Title": "Widget", "Color": "Purple", "Weight": 32 } } - Creating folders and items as
driveItemresources under a drive (document library) using:POST /drives/{drive-id}/items/{parent-item-id}/children POST /groups/{group-id}/drive/items/{parent-item-id}/children POST /me/drive/items/{parent-item-id}/children POST /sites/{site-id}/drive/items/{parent-item-id}/children POST /users/{user-id}/drive/items/{parent-item-id}/children
There is no supported pattern in the provided documentation for targeting a folder within a custom list as the parent of a new listItem via Graph, nor for moving an existing listItem into such a folder via parentReference.
References: