Colored Folders – How to Apply a Color Using Power Automate

August 7, 2023
5 min read
Syndicated

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.

Mark an Important Folder, or Specific Content Using Colors

You can assign a color to a selected folder in your library (Figure 1). 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.

Screenshot of colored folders in a SharePoint Document library.
Figure 1: Colored folders in action View Full Size

The feature is in the rollout phase, and you should be able to use it by 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 (Figure 2). It will be automatically applied to the folder.

Screenshot of the 3-dot menu showing how to assign color to a folder in SharePoint
Figure 2: Assigning color to a folder View Full Size

 

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.

Known Limitations of Applying Color to Folders

  • 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, the Invoices folder inside a General channel), but the color won’t be visible in Teams clients.

In Flows You Can Assign Colors Based on Logic with 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 the 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.

Screenshot of the form in Power Automate action “Send an HTTP request action”.
Figure 3: Power Automate’s “Send an HTTP request to SharePoint” action

 

2. Configure the action. 

     a. Select the Address of your site. 

     b. Select POST as a request method. 

     c. 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.

     d. Enter headers.

     e. Compose the body for the request. 

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

{
    "coloringInformation": {
        "ColorHex":"14"
    }
}
Screenshot of a filled-out HTTP request action in Power Automate to assign a color to a folder.
Figure 4: HTTP Request to assign a color to a folder View Full Size

3. Run the flow and test it.

API Methods

The flow logic to change a color depending on the action:

StampColor: Change a color of an existing folder:

_api/foldercoloring/stampcolor(DecodedUrl='/sites/<site name>/<library name>/<folder name>')

Back in step 2.e the body defines a color. You need to provide a path to the existing folder.

CreateFolder: Create a new folder with the selected color:

_api/foldercoloring/CreateFolder(DecodedUrl='/sites/<site name>/<library name>/<folder name>',Overwrite=<true of 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).

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 these methods and requires a code color. There are 16 colors.

Screenshot showing a table with the 16 available colors that you can change a folder to.
Figure 5: Table with available colors you can change folders to.

 

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😊.

Marcin Siewnicki

Marcin Siewnicki

Marcin Siewnicki is a Microsoft 365 consultant and architect. His IT adventure started in 2005. Since then he’s been creating and implementing business applications based on SharePoint and Microsoft 365 platforms. He is a big fan of tasks and process automation (Power Automate) and Modern Workplace platforms (Microsoft Teams).

Privately Marcin is a husband and father of two sons. He is a fan of science fiction and cyberpunk and is a futurist. Marcin is co-organizer of the CollabDays Poland conference and speaker at Microsoft’s community events.