Maintain list items for no-code developers

This post is part of my User guide to using the SharePoint REST API in Microsoft Flow for no-code developers series. In this post I will look at maintaining list items in SharePoint lists.

I will look at the following operations on a list in this post.

  • Get list item details
  • Create a list item

Getting the list item details is easy using the Send an HTTP request to SharePoint action. Simply select the Site Address and supply the API uri then supply the body details and a SharePoint coder would be quite happy to create all of this within less than no time. I have found however that no-code developers struggle sometimes.

To make all of this easy for no-coders, I’m going to start by setting some variables.

  • ListName
  • ListItemId

Maintain list items for no-code developers 1

Get the item details

First of all you could just use the Get Items action available in Microsoft Flow. But if you want to get to the more advanced options then the Send an HTTP request to SharePoint action might give you some more flexibility.

Maintain list items for no-code developers 2

And when we run the flow the details of my list item are returned:

Maintain list items for no-code developers 3

Note for code developers: You could run the HTTP request with nometadata rather than verbose as that may simplify the output a bit.

Create a list item

The Create a list item is slightly more complicated than the examples we have looked at so far. We will need two Send Http request to SharePoint actions. As mentioned on the REST API documentation we will need to get the ListItemEntityTypeFullName  first before we can create a list item.

Maintain list items for no-code developers 4

 

Now we can use the Type variable to create a new item

Maintain list items for no-code developers 5

8 thoughts on “Maintain list items for no-code developers

  1. commented on November 12, 2018 by Rob

    Hi,

    How is the body(..) expression constructed to capture the ListItemEntityTypeFullName?

    Thanks
    Rob

    • Hi Rob,

      The following will work:

      body(‘Send_an_HTTP_request_to_SharePoint’)?[‘d’][‘__metadata’]?[‘type’]

      Note that if you have multiple HTTP requests in your flow then you might have to update the name of the action in the above

      • commented on November 12, 2018 by Rob

        Hi Peter

        Brilliant, that worked perfectly.

        Thanks.
        Rob

      • commented on November 12, 2018 by Rob

        Hi Pieter

        It looks like that only allows me to create an item using the default “Title” column. If I try and add a value to the other columns on the list I get a “The property “ColumnName” does not exist on type ‘SP.List’” error. I’ve done a bit of digging and found the ListItemEntityTypeFullName for this list to be “SP.Data.Job_x0020_CardListItem”. If I use that in the body of the “send an http request to sharepoint 2” I can add values to the other columns. I just need to work out now how to get the ListItemEntityTypeFullName from the list programmatically. The intention is this flow will create items on many different sites.

        Thanks for the help
        Rob

      • Hi Rob,

        Sorry, my mistake. You are after this one:

        body(‘Send_an_HTTP_request_to_SharePoint’)[‘d’][‘ListItemEntityTypeFullName’]

      • commented on November 12, 2018 by Rob

        Perfect! thanks!

  2. commented on June 5, 2020 by Duncan Cooke

    Hi Rob, thanks for an informative article. I have run into a 401 unauthorized error and cannot work out what is wrong. I need to strip permissions from a list item and add new permissions(sharepoint group as well as named users). The first http request I send should strip the permissions. This is the uri:
    _api/lists/getByTitle(‘Lead Tracker’)/items(@{triggerBody()?[‘ID’]})/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)

    Do you perhaps have any advice on this issue?

    • commented on June 5, 2020 by Pieter Veenstra

      Hi Duncan,

      If you tried to do the same manually would it work?

      Which type of flow are you running? Scheduled, Manually start or automated?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: