Set-PnPView

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Set-PnPView.md to change this file.

Change view properties

Syntax

Set-PnPView
   [[-List] <ListPipeBind>]
   -Identity <ViewPipeBind>
   [-Values <Hashtable>]
   [-Fields <String[]>]
   [-Aggregations <String>]
   [-Connection <PnPConnection>]
   [<CommonParameters>]

Description

Sets one or more properties of an existing view, see here https://docs.microsoft.com/previous-versions/office/sharepoint-server/ee543328(v=office.15) for the list of view properties.

Examples

EXAMPLE 1

Set-PnPView -List "Tasks" -Identity "All Tasks" -Values @{JSLink="hierarchytaskslist.js|customrendering.js";Title="My view"}

Updates the "All Tasks" view on list "Tasks" to use hierarchytaskslist.js and customrendering.js for the JSLink and changes the title of the view to "My view"

EXAMPLE 2

Get-PnPList -Identity "Tasks" | Get-PnPView | Set-PnPView -Values @{JSLink="hierarchytaskslist.js|customrendering.js"}

Updates all views on list "Tasks" to use hierarchytaskslist.js and customrendering.js for the JSLink

EXAMPLE 3

Set-PnPView -List "Documents" -Identity "Corporate Documents" -Fields "Title","Created"

Updates the Corporate Documents view on the Documents library to have two fields

EXAMPLE 4

Set-PnPView -List "Documents" -Identity "Corporate Documents" -Fields "Title","Created" -Aggregations "<FieldRef Name='Title' Type='COUNT'/>"

Updates the Corporate Documents view on the Documents library and sets the totals (aggregations) to Count on the Title field

Parameters

-Aggregations

A valid XML fragment containing one or more Aggregations

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:PnPConnection
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Fields

An array of fields to use in the view. Notice that specifying this value will remove the existing fields

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Identity

The Id, Title or instance of the view

Type:ViewPipeBind
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-List

The Id, Title or Url of the list

Type:ListPipeBind
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Values

Hashtable of properties to update on the view. Use the syntax @{property1="value";property2="value"}.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False