Dec 07 2016 05:22 AM - edited Dec 07 2016 05:24 AM
Hi
Is there a way to use CSOM (Powershell or C#) to get the default page layout for an Enterprise Wiki site collection?
Thanks.
Dec 07 2016 11:08 PM
Dec 08 2016 12:19 AM
Hi @Deleted
It's not the homepage, but the default layout page that would be used when creating new Enterprise Wiki pages.
Thanks.
Dec 08 2016 12:28 AM
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:
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(oWeb); PageLayout pageLayout = pubWeb.DefaultPageLayout; Console.WriteLine("Title: " + pageLayout.Name + ", Url: " + pageLayout.ServerRelativeUrl);
Hope this was helpful.
Dec 08 2016 01:22 AM - edited Dec 09 2016 01:40 AM
Thanks for your reply, it helped me!
Here is my Powershell code using PnP:
Clear-Host Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/wiki -Credentials (Get-Credential)
$context = Get-PnPContext $allProperties = Get-PnPProperty -ClientObject $context.Web -Property AllProperties
$defaultLayoutPage = $allProperties['__DefaultPageLayout'] $defaultLayoutPage Disconnect-PnPOnline