Hi All,
I got the requirement to iterate large list items which are above throttling limits. Since we get the throttling exception when try to retrive items using caml query through standard process using server object model.
I used the "ListItemCollectionPosition" object to show items in the paging view.
I got the requirement to iterate large list items which are above throttling limits. Since we get the throttling exception when try to retrive items using caml query through standard process using server object model.
I used the "ListItemCollectionPosition" object to show items in the paging view.
$weburl=Read-Host "Enter site url" $web = Get-SPWeb -Identity $weburl $listname=Read-Host "Enter the list name" $list = $web.Lists["$listname"] if($list -ne $null) { write-host $list.Title $spQuery = New-Object Microsoft.SharePoint.SPQuery $spQuery.ViewAttributes = "Scope='Recursive'"; $spQuery.RowLimit = 10 $caml = '' $spQuery.Query = $caml do { $listItems = $list.GetItems($spQuery) Write-Host $listItems.ListItemCollectionPosition.PagingInfo $spQuery.ListItemCollectionPosition = $listItems.ListItemCollectionPosition foreach($item in $listItems) { Write-Host $item.Title } } while ($spQuery.ListItemCollectionPosition -ne $null) } else { write-host "List does not exist" }
No comments:
Post a Comment