pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
416 stars 642 forks source link

The property or field 'WelcomePage' has not been initialized #2324

Open StaffanNelemans opened 5 years ago

StaffanNelemans commented 5 years ago

Category

[x ] Bug [ ] Enhancement

Environment

[ x] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

Overwrite welcome page not erroring

Observed Behavior

[07/12/2019 07:33:21 > 67bb93: INFO] OfficeDevPnP.PartnerPack.ScheduledJob.exe Error: 0 : 2019-07-12 07:33:21.7534 [Pages] [1] [Error] Overwriting existing page {siteurl}/SitePages/Home.aspx failed: The property or field 'WelcomePage' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. : at Microsoft.SharePoint.Client.ClientObject.CheckUninitializedProperty(String propName) [07/12/2019 07:33:21 > 67bb93: INFO] at Microsoft.SharePoint.Client.Folder.get_WelcomePage() [07/12/2019 07:33:21 > 67bb93: INFO] at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) 216ms 1f35ce48-5e27-45c3-941c-3e35c92fde5a

Steps to Reproduce

Overwrite existing homepage

FIX

Updated OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPages line 27 from web.EnsureProperties(w => w.ServerRelativeUrl, w => w.RootFolder.WelcomePage); into web.EnsureProperties(w => w.ServerRelativeUrl, w=> w.RootFolder, w => w.RootFolder.WelcomePage); fixed the issue of unitialized error at line 65: web.RootFolder.WelcomePage;

ghost commented 5 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.