When trying to run a Get-PnPTerm cmdlet to return all terms in a large termset (10k or even 60k items), most of the time I get a timeout error as below:

Get-PnPTerm : The request channel timed out while waiting for a reply after 00:00:30. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

Is there a way to increase this timeout value in SPO? If not, is there a better way to return all those terms, e.g. in smaller batches and add to an array?



Basically I have an array of IDs ($IDs) an I'm trying to check if any of those ids are already in a term set.

#Get all existing terms
$allTerms = Get-PnPTerm -TermGroup $termGroup -TermSet $termSet -ErrorAction Stop | Select Name, Id 

#Convert to string for easy matching
$strAllTerms = $allTerms | Out-String -Stream

foreach ($id in $ids){
if ($strAllTerms -match $id) {*do something*}
  • Yes, You could retrieve terms in smaller batches and I would recommend that. Solutions are numerous, but the best solution for You will be based on Your existing code - could You provide that? – Kristaps Vilerts May 10 '19 at 6:43
  • Sure, added code to my initial post. I also have there some loops if there's a timeout when getting terms, but the code I posted above presents the general idea. – xmihu May 10 '19 at 11:58
  • @KristapsVilerts have you had a chance to look at this? ;) Thanks! – xmihu May 13 '19 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.