wivku
wivku

Reputation: 2643

get custom fields from SharePoint list item

Using the beta SharePoint REST API (using Microsoft Graph). Would like to get all items for a list, including the content of custom fields.

When I use https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}?expand=columns,items(expand=fields) I see (in my case):

The documentation shows an example of getting specific columns. When I use https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items?expand=fields(select=ID,Title,Status,Next_action)

Then I get an array with all items, and per item the object fields that only contains the property id.

So: the other standard fields (Title, Status) and the custom field Next_action do not show up.

How do I get the values for a list of standard and custom fields?


EDIT: more details about the lists that I have:

A couple of the lists are default ones that have been customized (I believe Tasks, Issues, Risks), others are completely custom (Decisions, Changes). The Tasks lists has versioning.
Some observations:

Possibly related, when using Flow I create a trigger for "when an item is created or modified", I am then presented with only 2 lists (Changes and Decisions). Missing: Tasks, Risks, Issues.

Tasks

Risks

Issues

Decisions

Changes

Upvotes: 5

Views: 2791

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

There seems to be a bug in the current /beta endpoint around $expand={field}($select={field}). I'm seeing similar results.

I am however seeing the complete list of fields when I use:

/beta/sites/{site-id}/lists/{list-id}/items?$expand=fields

I'm also able to return the complete set of columns, items and fields using:

/beta/sites/{site-id}/lists/{list-id}$expand=columns,items($expand=fields)

For the time being, you'll need to pull the entire collection and handle any additional processing in your app. Being a beta release there are several bugs still being worked out. This is why it isn't recommended that this be used for production.

Upvotes: 3

Related Questions