Created
March 31, 2017 18:53
-
-
Save star-crossed/81a9c55af95b02bf6f25b5a1b2e326d0 to your computer and use it in GitHub Desktop.
Example of adding row number and grouping by 200 to allow batches for CSOM's ExecuteQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$csv | ForEach-Object { | |
Add-Member -InputObject $_ -MemberType NoteProperty -Name 'Row' -Value ([int]($csv.IndexOf($_) / 200)) | |
} | Group-Object -Property 'Row' | ForEach-Object { | |
$_.Group | ForEach-Object { | |
# Compose your batch | |
} | |
$context.ExecuteQuery() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment