0

I have tried the following but it doesn't change the actual image on the page when you view it in the browser.

Set-PnPListItem -List "SitePages" -Id 2 -Values @{"BannerImageUrl" = " https://contoso.sharepoint.com/sites/mycomsite3/bannerimages/bread-braid-tedster-sml.jpg";}

What this code does do is change the value you see for page ID2 when you use this code.

# Get alist of all pages and their banner URLs
$items = Get-PnPListItem -List "SitePages" -Fields ID,Title,BannerImageUrl
$items | %{new-object PSObject -Property @{Id=$_["ID"];Title=$_["Title"];BannerImageUrl=$_["BannerImageUrl"].Url}} | select ID,Title,BannerImageUrl

My guess is that there is a property related to set-PNPClientSidePage that also needs changing.

Your help suggestions on how to use PNP commandlets would be greatly appreciated.

Cmdlet versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     2.18.17... SharePointPnPPowerShell2016         {Add-PnPContentType, Add-PnPContentTypeToDocumentSet,
    Directory: C:\Users\<user>\AppData\Local\Apps\SharePointPnPPowerShellOnline\Modules
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     2.18.17... SharePointPnPPowerShellOnline       {Add-PnPClientSidePage, Add-PnPClientSidePageSection,
    Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     2.18.17... SharePointPnPPowerShellOnline       {Add-PnPClientSidePage, Add-PnPClientSidePageSection,
Binary     2.17.17... SharePointPnPPowerShellOnline       {Add-PnPContentType, Add-PnPContentTypeToDocumentSet,

Cmdlet install

I think I’ve used the install-module method.

NOTE: I am not trying to remove the banner, that is easy to do using the UI (click the x below the image icon in the page edit view).

  • I've checked using SharePoint designer and when I run code like the following Set-PnPListItem -List "SitePages" -Id 29 -Values @{"BannerImageUrl" = "";} The code within the ASPX page is modified to <mso:BannerImageUrl msdt:dt="string"></mso:BannerImageUrl> But the page when viewed in the browser doesn't show no bannerimage. – Dorje Mckinnon Sep 28 '17 at 22:05
  • It's also logged in pnp as an open issue - github.com/SharePoint/PnP-Sites-Core/issues/1464 – Andrew Backway Jan 15 '18 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.