In this Power Automate tutorial, we will discuss Power Automate creating document Libraries. We will see here, Power automate create document library with a few examples. And also we will discuss the below points:
- Power Automate create a document library
- Power Automate create a folder in a document library
- Power Automate create a file in a document library
- Power Automate create a link in a document library
- Power Automate create add column document library
Power Automate create a document library
Here we will see how to create a document library using Power Automate.
As we don’t have an action to create a document library, we will use HTTP requests to create a document library.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Next, we will create a document library in SharePoint using an HTTP request. So click on the Next step and select Send an HTTP request to SharePoint action. Then Provide the site address and Method as Post.
Next, provide the below information:
Uri : _api/web/lists/
Headers:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
Body:
{
'AllowContentTypes': true,
'BaseTemplate':101,
'ContentTypesEnabled':true,
'Description':"",
'Title': 'Invoice'
}
Now click on Save and run the flow manually and you can see a Document library get created in SharePoint.
This is an example Power automate create a document library.
Read Power Automate Create SharePoint List
Power Automate create folder in document library
Here we will see how to create a folder in the document library using Power Automate.
Here we have a SharePoint list called Employee list, so when we add a new name, it will create a folder in the Document library using an HTTP request.
Document Library:
In Power Automate, select the trigger ‘When an item is created‘ action. Then provide the site address and list name.
Now we will create a folder in the SharePoint Document Library with HTTP requests. So click on the Next step and select Send an HTTP request to SharePoint action. Then provide the site address, Method as post, and provide the below information:
Uri : _api/web/GetFolderByServerRelativePath(decodedurl='Employee Details')/Folders
Headers:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
Body:
{ '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': 'Employee Details/@{triggerOutputs()?['body/Title']}'}
Now click on Save and to run the flow create an item in the SharePoint list, after that you can see a folder get created with the employee name.
This is how to create a folder in a document library using Power Automate.
Read Power Automate create an HTML table from SharePoint List
Power Automate create file in document library
Here we will see how to create a file in the Document library with an HTTP request.
We have a Library called Employee details, so here we will create a file with HTTP requests.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Now we will create a file in the SharePoint Document library, so click on the Next step and select Send an HTTP request to SharePoint action. Then Provide the site address, Method as Post and provide the below information:
Uri: _api/web/GetFolderByServerRelativeUrl('Employee Details')/Files/add(url='Emp.txt',overwrite=true)
Header:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
Now click on Save and run the Flow manually and you can see the file get created in the document library.
This is an example of how to create a file in a document library in Power Automate.
Read Power Automate send an email with an attachment from SharePoint
Power Automate create link in document library
Here we will see how to create a shareable link in the document library using Power Automate.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Now we will create a file in the document library, so select Create File action. Then provide the site address, folder path, file name, and file content.
Now we will create a Shareable link for the created file, then click on the next step and select Create sharing link for a file or folder action. Then provide the site address, library name, item id from dynamic content, Link type as view and edit, and Link scope as People and organization from option.
Now we will update the shareable link in the Link column, so click on the Next step and select Update file properties, then provide the site address, library name, id from dynamic content, and in the link column provide the sharable link from dynamic content.
Now click on Save and run the flow manually and you can see a file get created with the Shareable link.
This is how to create a link in a SharePoint document library using Power Automate.
Read Power Automate update SharePoint list item
Power automate create add column document library
Here we will see how to create multiple columns in the document library using Power Automate.
So here we have a document library called Invoice documents, in this document library, we will create multiple columns.
In Power Automate select the Manually triggered Flow, then click on the Next step.
Next, we will create an Array of columns, so click on the Next step and select Initialize variable action. Then provide the variable name, type as an array, and in value add the column like below
[
"Category",
"Quantity"
]
Now we will create an item in the SharePoint Document Library using an http request. So click on the Next step and select Apply to each action, then provide the variable in output.
Then click on add an action, and select Send an Http request to SharePoint action. Then provide the site address, method as Post, and then provide the below information:
URI : _api/web/lists/GetByTitle('Library name')/fields
Header:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
Body:
{
'__metadata':
{ 'type': 'SP.Field' },
"Title":"@{items('Apply_to_each')}",
"FieldTypeKind": 2
}
Now click on Save and run the Flow manually. After that click on add column, then click on Show and hide column and select the column you created.
Related Power Automate tutorials:
- Power Automate Add Days to Date
- Move files from OneDrive for Business to SharePoint Online
- Microsoft Flow Example: Copy files from one SharePoint Online account or folder to another
- Microsoft Flow Example Save tweets that include specific hashtag to a SharePoint list
- Microsoft Flow or PowerAutomate Example: Save my email attachments to a SharePoint document library
- Microsoft Flow or PowerAutomate Example: Send a customized email when a new file is added
This is an example of how to create a column document library using Power Automate. In this Power Automate tutorial, we learned Power Automate create a document library. And also we will discuss the below points:
- Power Automate create a folder in a document library
- Power Automate create a file in a document library
- Power Automate create a link in a document library
- Power Automate create add column document library
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
Can any of these steps be used to create a new view in a current library? Looking for a way for a user to complete a simple form which will be used as the basis for setting up a new site page along with creating a new folder in the library. On the site page I’m hoping to include a library webpart which would be filtered to only show items with the project title. Hoping I’d be able to use power automate to create the filtered view.
For the columns, it’s kind of important to know the FieldTypeKind options:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.fieldtype?view=sharepoint-csom