Adding A Document Library to Site via Power Automate


In SharePoint Online, you can automate various tasks, including the creation of document libraries, using Power Automate and the SharePoint REST API. This guide will show you how to add a document library to a SharePoint site using Power Automate.

We’ll use the “Send an HTTP Request to SharePoint” action and the SharePoint REST API to create a document library. Follow these steps to add a document library to your SharePoint Online site using Power Automate:

Step 1: Create a Power Automate Flow
  1. Navigate to Power Automate:
    • Go to your Power Automate portal and click on Create to start a new flow.
  2. Choose a Trigger:
    • Select a trigger for your flow, such as “When an item is created” or “Manually trigger a flow.”
Step 2: Send an HTTP Request to SharePoint
  1. Add HTTP Request Action:
    • Click on New Step and select “Send an HTTP Request to SharePoint.”
  2. Configure the HTTP Request:
    • Set up the HTTP request with the following details:
Site Address: Choose SharePoint Site you want to add the document library to.
Method: POST
URI: _api/web/lists
Headers:
{
      "Accept": "application/json;odata=verbose",
      "Content-Type": "application/json;odata=verbose"
}
Body:
{
     "__metadata": {
     "type": "SP.List"
  },
    "BaseTemplate": 101,
    "Title": "Your Library Name"
}
Step 3: Save and Test the Flow
  1. Save the Flow:
    • Click Save at the top right corner of the screen to save your flow.
  2. Test the Flow:
    • Run your flow using the Test > Manually options at the top right.
    • Once the flow runs successfully, a new document library will be created in the specified SharePoint site.

This is how the flow should look in Power Automate:

Summary

By following these steps, you can automate the creation of document libraries in SharePoint Online using Power Automate. This method leverages the “Send an HTTP Request to SharePoint” action along with the SharePoint REST API to streamline the process, making it easier to manage your SharePoint environment.

Automating tasks like this can save time and reduce the potential for errors, especially when dealing with repetitive actions. Power Automate provides a powerful and flexible way to enhance your SharePoint workflows and improve productivity.

Spread the word

Leave a Reply