web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Problem with "Send an ...
Power Automate
Answered

Problem with "Send an HTTP request to SharePoint 2" in a Loop for changing Colors of Folders.

(0) ShareShare
ReportReport
Posted on by 20

I'm stuck right now.

I'm trying to create a Flow that changes the Color of the SharePoint folders when I populate them with Documents.

The problem is, when I use the Request with the Loop Item it runs forever till it crashes.

Here is the Part of the Flow in the Loop.

Problem with this FlowProblem with this Flow

 

The output of the Compose Test Input to HTTP Request spits out the exact string I normally need.

Also, a Separated Folder is an array where only the Folder paths are stored.

Exmaple Output of the Folder ArrayExmaple Output of the Folder Array

As you can see the Loop is then running up to a runtime error.

If I delete or set the input in the HTTP Block as a static value it runs fine.

Loop 1Loop 1Loop 2Loop 2

 

I have used the same method in a bigger Flow and it worked completely fine.

How I made it in the bigger FlowHow I made it in the bigger Flow

 

Does anyone know why this happens? 

I'm clueless and tried a lot of different methods.

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,801 Most Valuable Professional on at

    Hi @NiBes,

     

    Just to double check. You demonstrated what array content you are using in a Compose action (Compose Separated Folders). However, the apply to each uses a variable instead.

     

    I assume that variable has the same array value? You have set that value in either the initialize variable action or a set variable action, correct?

     

    Can you also share you concat function expression. I can probably guess what is in there (a concat of the API url with the current item 😁), but it might be useful to know as well for troubleshooting.

  • NiBes Profile Picture
    20 on at

    Hi @Expiscornovus thanks for your help,

     

    my concat Funktion was

     

     

    concat(variables('Begin Api'),items('Apply_to_each_2'),variables('End Api'))

     

     

    "Begin Api" = _api/foldercoloring/stampcolor(DecodedUrl='/sites/KEG-Spielwiese-GE/

    "End Api"=')

     

    I also tried, _api/foldercoloring/stampcolor(DecodedUrl='/sites/KEG-Spielwiese-GE/items('Apply_to_each_2')').

     

    And Yes I have a Loop where I Split the whole File Path into parts and add them piece by piece to get there and append them to the Array Variable called "Separated Folders".

    The Compose & Compose Separated Folders should be a debug print for me to check if the array contains all the necessary paths.

     

    In the same Flow The If statment also works, if it is a Folder and the Full Path is added.In the same Flow The If statment also works, if it is a Folder and the Full Path is added.

     

    I hope these helped a bit, or do you need more Infos?

  • Verified answer
    Expiscornovus Profile Picture
    33,801 Most Valuable Professional on at

    Hi @NiBes,

     

    What is the name of your Document Library? That seems to be missing in your DecodedUrl path in your Begin Api variable. That might explain why it cannot find the folders of your array and it will timeout.

     

    Or is Technology the name of your library? In that case it might timeout because of the first item of your array. In that case it tries to apply a folder colour to a library which probably will not work.

     

    Below are my test runs.

    I applied the colour green to the Technology and OBS folder (nested within Technology) within a library with the name Coloured Folders.

     

    separatedfolders02.png

     

    I also used verbose headers

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

    And I have added the metadata and type fields.

    {
    "coloringInformation": {
    "__metadata": { "type": "SP.FolderColoringInformation" },
    "ColorHex": "3"
    }
    }

    separatedfolders.png

  • NiBes Profile Picture
    20 on at

    Dam,

    you saved my day. I tried a lot the last few days but I was not able to figure out that "Technology" was the Document Library and calling a request to change a Folder Color on a library will not work and will cause an infinity loop.

    My page called "Spielewiese" is a testing ground from my company where every user can test what they want on so it looks different than the usual SharePoint pages and nobody could tell me what exactly was done to it...

    Spielewiese - TechnologySpielewiese - Technology

    I simply added an If statement to filter the only library name out and now it works fine.

     

    Is there a benefit of using verbose headers? (never heard of them before)

     

    I never heard of them.

  • Expiscornovus Profile Picture
    33,801 Most Valuable Professional on at

    Hi @NiBes,

     

    With this request the Accept and Content-Type keys in the headers section are not really required. I always like to use them, just in case.

     

    Sometimes it can be useful to set them with different values as well. You can for example use them to retrieve data without the metadata. Here is an example:

    https://learn.microsoft.com/en-us/sharepoint/dev/business-apps/power-automate/guidance/working-with-send-sp-http-request#use-json-light

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 304

#2
David_MA Profile Picture

David_MA 245 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 243 Most Valuable Professional

Last 30 days Overall leaderboard