Calling the SharePoint REST API in a Microsoft Flow

Published on Author Rob Windsor1 Comment

I’ve been doing a lot of work with Microsoft Flow lately and I came across a situation where I needed to make a call to the SharePoint REST API to move a list item from one folder to another. There’s currently no move action in Flow but there is a moveTo function in the REST API.

I did some Googling and I found several posts that showed how to register an add-in, make app-only permissions requests for the add-in, trust the add-in, and then use the HTTP action in Flow to get the bearer (access) token using the add-in Client ID and Secret so you could then use the HTTP action to make the REST API call. I followed the steps described in the posts and was able to make the REST API call to move the list item. This is one example of the posts to which I’m referring: How to Call the SharePoint REST Webservice from Microsoft Flow.

A short time later I was looking for something else when I noticed the ‘Send an HTTP request to SharePoint’ action. This action could have been named ‘Make a SharePoint REST API Call’ because that is exactly what it enables you to do – without having to go through all the setup described above.

In the example below I’m using the ‘Send an HTTP request to SharePoint’ action to execute a CAML query. Note that I am not passing the form digest in the headers. This is not required from what I’ve seen so far.

Send an HTTP request to SharePoint

One Response to Calling the SharePoint REST API in a Microsoft Flow

  1. Nice 🙂

    I guess that this will make it kinda trivial to set up a timer based Flow that calls the SharePoint Search REST API, ferching all Tasks across the Tennant or Site Collection and for each of them checking that owner is still an not-blocked AAD user That will make out Governance sooo much better.

Leave a Reply

Your email address will not be published. Required fields are marked *

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