Set-PnPView

Change view properties

Syntax

Set-PnPView
   -Identity <ViewPipeBind>
              [-List <ListPipeBind>]
              [-Values <Hashtable>]
              [-Fields <String[]>]
              [-Web <WebPipeBind>]
              [-Connection <SPOnlineConnection>]

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

Parameters

-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:SPOnlineConnection
Position:Named
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
Accept pipeline input:False
Accept wildcard characters:False
-Identity

The Id, Title or instance of the view

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

The Id, Title or Url of the list

Type:ListPipeBind
Position:0
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
Accept pipeline input:False
Accept wildcard characters:False
-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.SharePoint.Client.Field