Last active
April 6, 2021 16:14
-
-
Save pmatthews05/b741485a169b645433c1676215fe0485 to your computer and use it in GitHub Desktop.
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
function Get-ListDataAsStream { | |
param ( | |
[Parameter(Mandatory)] | |
[string] | |
$SiteUrl, | |
[Parameter(Mandatory)] | |
[string] | |
$ListName, | |
[Parameter(Mandatory)] | |
[string] | |
$CAMLQuery, | |
[Parameter(Mandatory = $false)] | |
[string] | |
$NextLink | |
) | |
$QueryUrl = "$SiteUrl/_api/web/lists/GetbyTitle('$ListName')/RenderListDataAsStream" | |
Write-Information -MessageData:"QueryUrl:$QueryUrl" | |
if ($NextLink -and $NextLink.StartsWith('?')) { | |
$NextLink = $NextLink.Substring(1) | |
Write-Information -MessageData:"Paging:$NextLink" | |
} | |
$body = @{ | |
parameters = @{ | |
Paging = $NextLink | |
RenderOptions = 2 | |
ViewXml = $CAMLQuery | |
} | |
} | |
return Invoke-PnPSPRestMethod -Url:"$QueryUrl" -Method:Post -ContentType:"application/json;odata=nometadata" -Content:$body | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment