Set-PnPMasterPage

Set the masterpage

Syntax

Set-PnPMasterPage
   [-MasterPageServerRelativeUrl <String>]
                    [-CustomMasterPageServerRelativeUrl <String>]
                    [-Web <WebPipeBind>]
                    [-Connection <SPOnlineConnection>]
Set-PnPMasterPage
   [-MasterPageSiteRelativeUrl <String>]
                    [-CustomMasterPageSiteRelativeUrl <String>]
                    [-Web <WebPipeBind>]
                    [-Connection <SPOnlineConnection>]

Description

Sets the default master page of the current web.

Examples

------------------EXAMPLE 1------------------

Set-PnPMasterPage -MasterPageServerRelativeUrl /sites/projects/_catalogs/masterpage/oslo.master

Sets the master page based on a server relative URL

------------------EXAMPLE 2------------------

Set-PnPMasterPage -MasterPageServerRelativeUrl /sites/projects/_catalogs/masterpage/oslo.master -CustomMasterPageServerRelativeUrl /sites/projects/_catalogs/masterpage/oslo.master

Sets the master page and custom master page based on a server relative URL

------------------EXAMPLE 3------------------

Set-PnPMasterPage -MasterPageSiteRelativeUrl _catalogs/masterpage/oslo.master

Sets the master page based on a site relative URL

------------------EXAMPLE 4------------------

Set-PnPMasterPage -MasterPageSiteRelativeUrl _catalogs/masterpage/oslo.master -CustomMasterPageSiteRelativeUrl _catalogs/masterpage/oslo.master

Sets the master page and custom master page based on a site relative URL

Optional 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
-CustomMasterPageServerRelativeUrl

Specifies the custom Master page URL based on the server relative URL

Type:String
Aliases:CustomMasterPageUrl
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-CustomMasterPageSiteRelativeUrl

Specifies the custom Master page URL based on the site relative URL

Type:String
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-MasterPageServerRelativeUrl

Specifies the Master page URL based on the server relative URL

Type:String
Aliases:MasterPageUrl
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-MasterPageSiteRelativeUrl

Specifies the Master page URL based on the site relative URL

Type:String
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