I have written a PowerShell script that connects to few thousands of SharePoint sites one by one to verify each site's navigation and webpart configurations. Each time I run the script, I randomly get error messages such as:
我已经编写了一个PowerShell脚本,它逐个连接到数千个SharePoint站点,以验证每个站点的导航和Web部件配置。每次运行该脚本时,我都会随机收到如下错误消息:
- The remote name could not be resolved: 'powerconewzealand.sharepoint.com'
- The remote server returned an error: (403) Forbidden.
By 'randomly', I meant in the first run maybe site 1001 through 1045 would have the error, and in another run maybe site 2030 to 2076 would have the error.
我的意思是,在第一次运行时,站点1001到1045可能会出现错误,而在另一次运行中,站点2030到2076可能会出现错误。
I suspect maybe SharePoint temporarily stops access to sites when it detects too many requests are made. I tried to add in logic so the script will connect to 500 sites (one by one and check the stuff), then pause for 10 minutes, then do the next 500, until all sites are checked. But I still get those error messages. I chose batch of 500 because the error usually don't happen to the first 1000+ sites.
我怀疑,当检测到发出太多请求时,可能是SharePoint暂时停止了对网站的访问。我试着添加逻辑,这样脚本将连接到500个站点(一个接一个地检查材料),然后暂停10分钟,然后执行下一个500,直到所有站点都被检查完。但我仍然收到这些错误消息。我选择了500批次,因为错误通常不会发生在前1000+站点上。
I thought it might be a throttling issue, but according to MS Docs, the errors returned by throttling would be 429 ("Too many requests") or 503 ("Server Too Busy"), which doesn't match to the erroes I have been getting.
我认为这可能是一个限制问题,但根据MS Docs的说法,限制返回的错误将是429(“请求太多”)或503(“服务器太忙”),这与我收到的错误不匹配。
When I browse those sites in browser using the same credential, there were no issues.
当我使用相同的凭据在浏览器中浏览这些站点时,没有出现任何问题。
I'm interested to know if anyone knows why Connect-PnPOnline would fail with those error messages.
我很想知道是否有人知道为什么Connect-PnPOnline会失败,并显示这些错误消息。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!