SharePoint REST API: How to find the List or Library “__metadata” “type”

When using the SharePoint REST API to update objects such as lists or items, you will need to pass the “__metadata” “type”. This is generally straightforward, unless you encounter an anomaly, which I will attempt to describe.

For updating a list item, the “__metadata” “type” is usually “SP.Data.ListNameItem”, which is based on the list’s URL, for example: https://[tenant][site]/lists/listname. However, in some cases, I have seen the exact same API call (code) used in other Office 365 tenants where the required value is “SP.Data.ListNameListItem”.

Please refer to Microsoft’s ‘Update list item’ article for details on how to use the SharePoint API to update a list item.

I have no idea why these differences may exist, but here’s how I confirm that I have the correct value: Copy and paste the following URL into your favorite browser, replacing the values in square brackets to match your environment:

https://[tenant][site]/_api/web/lists/GetByTitle('[List Or Library Title]')

Next, search for the value between the ‘<d:ListItemEntityTypeFullName>’ tags:


And there you have it.

Alternatively, you can use the Microsoft Graph API as a “modern” and preferred method for SharePoint operations, which doesn’t require this knowledge but does require more upfront effort. See Microsoft’s ‘Updating Item’ article for more information on using the Graph API.

%d bloggers like this: