Blog

Microsoft Flow: Create a SharePoint Folder When a List Item is Created Using a REST API

Microsoft Flow: Create a SharePoint Folder When a List Item is Created Using a REST API

Microsoft Power Automate (formerly Microsoft Flow) is an excellent application to automate daily business processes. There are over 200 data connectors and it is intuitively simple to use. 

Recently, I was developing a Flow to create a new folder in a certain SharePoint library when a SharePoint list item was created. Then, the Flow would send an email to the creator of the list item saying that the folder has been created.

I found that the easiest way to do this is by using a REST API. 

If you're like me, you may go through a lot of troubleshooting and trial and error. By following these steps, your Flow will be very easy to accomplish and up and running in no time. 

Creating the Flow

  1. Navigate to the left side of the Microsoft Flow home page and click "create" 
    • Create a blank, Automated Flow
      create flow
  2. Name your flow and pick your trigger
    • In this case, we will connect to SharePoint and our trigger will be "when an item is created." 
      pick flow trigger
  3. Enter your SharePoint site address and your list name
    • For the purposes of this example, the site is called "YourSite" and the list name is called "Testing" 
  4. Add a step to your Flow by clicking "new step" 
    adding the next step
  5. Choose an action. Search "SharePoint" within the search box
    • Our first action is going to be "Send an HTTP request to SharePoint." 
      first action - send http request to sharepoint
    • This is where our REST API comes into play. 
  6. Below is how we set up our HTTP request: 
    http request to sharepoint
    • The JSON headers can be copied and pasted: 
      {
        "accept": "application/json; odata=verbose",
        "content-type": "application/json; odata=verbose"
      }
      
  7. Add your next step by again inserting a new step, and searching SharePoint again
  8. This step is called "Create sharing link for a file or folder"
    • This will create the link to your new folder that will be used in the email notifying the user that created the SharePoint list item
      create the sharing link
  9. Add your next step: "Send an email"
    • This step is connected to Outlook, rather than SharePoint. 
      • If you use another email service, such as Google, you can still complete this step but you will need to use a different action.
    • This step will send the person who created the list item in the original SharePoint list an email with a link to the newly created folder in the SharePoint library
      send the email with flow

And that's it! It's rather simple, right? This is a great way to automate some of your daily SharePoint business processes. 

Learn more about DMC's expertise with Microsoft's Power Platform and contact us with any project inquiries. 

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts