Colored Folders – How to apply a color using Power Automate

Colored Folders - How to use via Power Automate

Microsoft released a new feature called Colored Folders. It’s available both in OneDrive and SharePoint Online. You can use it to apply color to a special folder to categorize manually data based on the content inside. You can also use Power Automate and automate the whole process. In this post, I will show you basic information about the feature and how to use it in Power Automate.

Introduction

You can assign a color to a selected folder in your library. For personal use, it’s a great way to mark an important folder or specific content using colors (for example – mark financial data as green). You can also use it in your team – mark the folder with incident reports as a red one.

The feature is in the rollout phase, and you should be able to use it this month (August 2023). I can use it in most of my environments, but some are still waiting for it.

Assigning colors feature is available directly from the folder action menu. Select a folder, then Folder color and choose a color. It will be automatically applied to the folder.

The feature is available for:

  • Existing folders – you can change the color of an existing folder
  • New folders – you can select the color when you create a new folder
  • Renaming folders – you can select the color in the renaming folder process

Limitations

  • This feature is available only in the web browsers
  • You can’t change the color of Teams channel folders (for instance, you can’t change the color of a General folder).
  • You can change the color of a folder inside a Teams channel folder (for instance, folder ‘Invoices’ inside a General channel), but the color won’t be visible in Teams clients.

Power Automate

The colored folders feature is available in the user interface in SharePoint and OneDrive. There is also a way to use it directly from the Flows – you can automate this process and assign colors based on your own logic using Power Automate!

To do this you can use Send an HTTP request to SharePoint action in a Flow. In this example, I will build a Flow that changes the color of the existing folder Invoices in the ThePerspectiveTest site.

1. Add a Send an HTTP request to SharePoint action to your Flow

2. Configure the action

– Select the Address of your site

– Select POST as a request method

– Compose the Uri for the request

_api/foldercoloring/stampcolor(DecodedUrl='/sites/ThePerspectiveTest/Documents/Invoices') 

The value for DecodedUrl is your folder path, and you must compose it based on your site and folder structure.

– Enter headers

– Compose the body for the request

The body required ColorHex parameter with a string value. You can use values from 0 to 15.

{   
   "coloringInformation": {     
      "ColorHex":"14"
   }
}

3. Run the flow and test it.

API Methods

There are 3 methods in the API:

1. StampColor – change a color of an existing folder

_api/foldercoloring/stampcolor(DecodedUrl='/sites/<site_name>/<library_name>/<folder_name>')

You need to provide a path to the existing folder.

2. CreateFolder – create a new folder with the selected color

_api/foldercoloring/CreateFolder(DecodedUrl='/sites/<site_name>/<library_name>/<folder_name>',Overwrite=<true_or_false>)

You need to provide a path to a new folder. You can also select if you want to overwrite the existing folder or not (this is optional).

3. RenameFolder – rename a folder and change color at the same time

_api/foldercoloring/RenameFolder(DecodedUrl='/sites/<site_name>/<library_name>/<folder_name>',newName='<new_folder_name>')

You need to provide an existing folder path and a new name.

Color codes

The body is the same for all methods and requires a code color. There are 16 colors.

Summary

It’s a really nice feature and it could be helpful in many scenarios. For me it’s a must-have in my OneDrive folder structure – It will help me quickly find my most important folders.

If you want to use it in SharePoint just keep in mind that you should describe colors and their meaning to your team. Using Power Automate you can also create rules and apply colors automatically to folders. Just keep in mind that coloring every single folder won’t help you. Use common sense😊

You may also like

Leave a Reply

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