Throttling in the SharePoint connector in Power Automate is a very common issue with many flows. But how do you deal with those pains?

Take a break

I’ve been back from a week holiday and I’ve only been back

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online sandybay

for a couple of hours and I’m hitting some real pains straightaway. I will start by explaining the setup a bit.

The flow setup

I’ve got 30 documents. On setting a document property Power Automate is triggering my flow for each document using a When a file is created or modified action.

Then I collect the content of the document triggering each of the flows. Then I create a copy of the document in a different library and I’m updating the document properties with the REST API call.

When I submitted my 30 documents I noticed that SharePoint would hang up with the following error on a page with the /_layouts/15/Throttle.htm#2057 url

Something’s not right

The page you requested is temporarily unavailable. We apologize for the inconvenience, please check back in a few seconds.

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online somethings not right

Yes, This is very inconvenient! Luckily Throttling is initially something on a user by user basis. At least you don’t have to worry about your other users.

When the page then finally comes back I found a similar error when I try to do a bulk edit of my document properties:

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online properties cannot be displayed

or the Something’s not right messages:

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online somethings not right 2

Lists views give the annoying bike with a flat tire images.

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online somethign went wrong bike

Then as my flows complete all seems to recover, ok. Quite quickly I ended up on the following page:

How to avoid getting throttling or blocked in SharePoint Online

The (potential) solution to stop throttling issues

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online retry

In the retry settings for the SharePoint connector there are a few options available that may help. If we focus on the retry setting. Flow is retrying 4 times for 429 failures.  You will find that flow might be failing with 429 errors. So we could increase our retries ensuring that Microsoft Flow will be able to complete the job without failure. This can be done by switching from the default  to Fixed Interval or Exponential interval.

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online retry policy

But we will have to be careful here! As we have seen above, the user interface is struggling too. We don’t want to make the experience in the user interface any worse.

CSOM Throttling in the SharePoint connector in Power Automate Microsoft Flow, Microsoft SharePoint Online optimized

In my case I found it better to review the actions. Within my flow I only want to create the file with the file content under certain circumstances. I’m using conditions to make these choices. Where initially I was collecting the file content before my condition step I now included these just above the create file.

This means that if my condition isn’t met I’m not collecting the file contents. Even though this increases the number of actions in my flow it reduces the number of Get file actions run within my flow. Therefore rather than trying to reduce the number of actions in a flow it might be better to reduce the number of actions run instead.

I have found however that my flows were working just fine before. So somehow it looks like the number of CSOM calls has increased.

The next step in my investigation was to disable my flow, upload my 30 documents and the problem still appears. I noticed that when I update 3 documents in my library my flows are doing what they need to do, however when I modify 4 documents my SharePoint Online crashes with the CSOM /REST API throttling issues.

When I investigated the issue further I found the PowerShell for Flow very useful.

With the following few lines I found very quickly all my flow runs and I found that one of my flows was spinning around as there were many flow runs with the same start time

$flows = (Get-AdminFlow)

foreach ($flow in $flows)
{
  Write-Host -ForegroundColor Yellow $flow.DisplayName

  Get-FlowRun -FlowName $flow.FlowName
}

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: