pnp / PnP-Sites-Core

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

Cannot publish a page in powershell that has full-width column section. #1923

Open eBehbahani opened 6 years ago

eBehbahani commented 6 years ago

I recently started experimenting with the full-width webparts and deploying them via powershell. I'm seeing the same issue as @AriGunawan from issue #1304 after having installed the latest verison of SharePoint PnP PowerShell (ver. 3.1.1809.0).

Category

[x] Bug [ ] Enhancement

Environment

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

Expected or Desired Behavior

The desired behavior is that the modern client side page gets published with all webparts and webpart properties set.

Observed Behavior

What I see instead is the following error when running the script: Set-PnPClientSidePage : You cannot host this web part inside a one column full width section, only webparts that support full bleed are allowed When I navigate to the page that has been created, I see all the webparts and webpart properties have been set, but the page has not been published. I can manually publish through the UI though.

Steps to Reproduce

  1. Create a webpart
  2. Go to the manifest and set "supportsFullBleed": true
  3. Create and deploy the webpart package to your site.
  4. Now run the following script $pageName = "Test.aspx" Connect-PnPOnline –Url $targetWebUrl –UseWebLogin $page = Add-PnPClientSidePage -Name $pageName -LayoutType Home Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumnFullWidth Add-PnPClientSideWebPart -Page $page -Section 1 -Column 1 -Component TestWebpart Set-PnPClientSidePage -Identity $pageName -CommentsEnabled:$false -Publish
  5. The script should fail on Set-PnPClientSidePage
shri230686 commented 5 years ago

Hi Guys, did anyone found any solution ? I am also having the same problem.

steevinBradlee commented 4 years ago

Any solution found for this yet?

Urgeoverkill commented 4 years ago

Any Ideas? Same problem for me.

steevinBradlee commented 4 years ago

I think I got this working a while ago, but I'm not exactly sure what I had to change. Extract of working code below:

Add-PnPClientSidePageSection -Page $PageName -SectionTemplate OneColumnFullWidth -Order 1 -ZoneEmphasis 2
# Hero
Add-PnPClientSideWebPart -Page $PageName -DefaultWebPartType Hero -WebPartProperties ($global:heroProperties | ConvertTo-Json -Depth 10) -Section 1 -Column 1 -Order 1
Set-PnPClientSidePage -Identity $PageName -CommentsEnabled:$false
Set-PnPFileCheckedIn -Url $pageServerRelativeUrl -CheckinType MajorCheckIn
Set-PnPClientSidePage -Identity $PageName -Publish -LayoutType Home

It could be that performing a major check in on the site page file allowed me to then publish it. Hope this helps!