Get the default page layout for an Enterprise Wiki?

Brass Contributor



Is there a way to use CSOM (Powershell or C#) to get the default page layout for an Enterprise Wiki site collection?



4 Replies
You could get the homepage of any sitecollection using PNP

Hi @Deleted


It's not the homepage, but the default layout page that would be used when creating new Enterprise Wiki pages.



SharePoint Folder object has WelcomePage property.

E.g., for a web: `oWeb.RootFolder.WelcomePage`.


Page layout is not the same. For publishing web a default layout can be:

- Gotten by retrieving DefaultPageLayout property

- Redefined by SetDefaultPageLayout method

Also, you can get a list of available page layouts:

- GetAvailablePageLayouts


PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(oWeb);
PageLayout pageLayout = pubWeb.DefaultPageLayout;
Console.WriteLine("Title: " + pageLayout.Name + ", Url: " + pageLayout.ServerRelativeUrl);

Hope this was helpful.

Hi @Andrew Koltyakov


Thanks for your reply, it helped me!


Here is my Powershell code using PnP:



Connect-PnPOnline -Url https://<tenant> -Credentials (Get-Credential)

$context = Get-PnPContext $allProperties = Get-PnPProperty -ClientObject $context.Web -Property AllProperties

$defaultLayoutPage = $allProperties['__DefaultPageLayout'] $defaultLayoutPage Disconnect-PnPOnline