In SharePoint, managing folder metadata is essential for organizing files efficiently. We group files into folders, and updating their metadata improves categorization. However, manually updating folder metadata can be time-consuming and requires contant effort.
Automating this process with Power Automate offers several benefits:
- Time savings: Remove manual effort.
- Consistency: Always applied according to your logic.
- Error reduction: Minimize human errors when updating folder properties.
One common approach might be to first use the “Get file properties” action to retrieve the folder’s metadata, followed by the “Update file properties” action to update the metadata. While this flow will execute successfully, it may, however, fail to update the folder metadata as intended in your SharePoint Document Library.
This is where the REST API approach comes into play. Using the REST API in Power Automate, you can effectively update folder metadata.
REST API Inputs for Updating Folder Metadata
Method: POST
URI:
_api/web/GetFolderByServerRelativeUrl(‘/sites/SiteName/DocumentLibrary/FolderName/’)/ListItemAllFields
- SiteName: Replace with your SharePoint site name.
- DocumentLibrary: Replace with the name of your document library.
- FolderName: Replace with the folder name
Headers:
{
“If-Match”: “*”,
“X-HTTP-Method”: “MERGE”,
“Accept”: “Application/json;odata-verbose”
}
- If-Match:
*
ensures that the update is performed on the latest version of the folder metadata. - X-HTTP-Method:
MERGE
allows updating the existing metadata without affecting other properties. - Accept: Specifies that the response should be in JSON format.
Body:
In the Body, you define the metadata field(s) you want to update. For example, if you want to update the “TrainingMonth” metadata field, the body would look like this:
{
“TrainingMonth”: “JAN-2025”
}
You can modify the field name and value based on your specific requirements.
Flow Design-
I have updated the “TrainingMonth” metadata for the SharePoint document library folder, as shown below:
Automating SharePoint folder metadata updates with Power Automate is a time-saving, efficient way to manage your SharePoint content. The REST API approach provides a more direct and customizable way to update folder metadata in SharePoint using Power Automate, allowing you to bypass some of the limitations of default actions.