Skip to content

Instantly share code, notes, and snippets.

@dmadelung
Created January 29, 2018 15:33
Show Gist options
  • Save dmadelung/49faf431f838dabedd70e39ddfe80ef7 to your computer and use it in GitHub Desktop.
Save dmadelung/49faf431f838dabedd70e39ddfe80ef7 to your computer and use it in GitHub Desktop.
$list = Get-PnPList "List"
$view = Get-PnPView -List $list -Identity "All Documents"
$vto = $view.TypedObject
$view.Context.Load($vto)
$view.Context.ExecuteQuery()
$vto.ViewQuery = "<OrderBy><FieldRef Name=`"Modified`" Ascending=`"False`" /></OrderBy><Where><Neq><FieldRef Name=`"DocumentState`" /><Value Type=`"Text`">Obsolete</Value></Neq></Where>"
$view.Update()
$view.Context.ExecuteQuery()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment