How to fixed error 429 in SharePoint PowerShell

Aase Nomad 246 Reputation points
2023-01-24T23:35:57.3766667+00:00

I'm trying retrieve OneDrive site using like this and it's working fine but sometime I get " The remote server returned an error: (429)."

I do believe I'm getting that error because I request too many time in my script and getting throttled. I would be really appreciated if I can get any suggestion or help on how to handle that error.

   $allSites = Get-SPOSite -IncludePersonalSite $true -Limit All | Where-Object { $_.URL -like "*$ID*" }

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,827 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,044 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,619 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,552 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 36,171 Reputation points Microsoft Vendor
    2023-01-25T05:35:22.26+00:00

    Hi @Aase Nomad

    When the user sends too many requests within a given time or get throttled in SharePoint Online, maybe cause this error:

    v-henryk-mstf_0-1621491790353.png

    It is recommended that you can change the filter condition to reduce the sites to retieve in one query. You can divide one query to servral query to excute and add “pause” between requests also helps to reduce throttled

    Here is the reference document link:Avoid getting throttled or blocked in SharePoint Online | Microsoft Docs


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.