#This script gets the totals from a list view | |
Connect-PnPOnline https://siteurl | |
$context = Get-PnPContext | |
$list = $context.Web.Lists.GetByTitle("mylist") | |
$view =$list.Views.GetByTitle("MyViewWithTotals") | |
$context.Load($view) | |
$context.ExecuteQuery() | |
# we only need one item, not more | |
$viewxml = $view.ListViewXml -replace '<RowLimit Paged="TRUE">\d*</RowLimit>','<RowLimit>1</RowLimit>' | |
$result = $list.RenderListData($viewxml) | |
$context.ExecuteQuery() | |
$obj = ConvertFrom-Json $result.Value | |
$row = $obj.Row[0] | |
# Now use your values | |
$count = $row.'LinkTitle.COUNT' | |
$sizeSum = $row.'size.SUM' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment