Forum Discussion
Modern WebPage - Error with getpreview.ashx when a Repost page is published
Dear all,
I'm trying to use the modern pages to share the news published in Old Publishing site using the Modern Repost Page solution:
- Read my previous post for that case: https://techcommunity.microsoft.com/t5/SharePoint/How-to-create-Repost-Page-Modern-Page-Library-with-PowerShell/m-p/269332#M22430
Now i'm fighting with another issue related to the Picture Preview implemented into the Modern News WebPart.
This webpart is showing the last Repost Pages (created manually), but refuse to show many of the pictures associated, as you can see in the following screenshot.
Published news in webpart mode
Published news in list mode
I don't know why but only one picture library is supported by the preview ashx:
- https://[mytenant].sharepoint.com/[mysubsite]/_layouts/15/getpreview.ashx?resolution=3&path=%2Fmysubsite%2Ffunctions%2Fcom%2Fpublishingimages%2Flatest%20emailing.business.jpg&clientType=modernWebPart
I checked the Details of the news to check if the picture is correctly configured into, and it works well:
Details for one published news
When I open the Image src URL of this preview system with Internet Explorer, I received an Error 500 (Internal Server Error), with FireFox nothing is shown.
The SharePoint Root page (https://[mytenant].sharepoint.com/_layouts/15/sharepoint.aspx) is showing the image without any issue.
Is there anyone who can give my an idea to fix that ?
Fabrice Romelard
3 Replies
- FromelardIron Contributor
I probably found a direction to look for this picture issue.
When I add the picture as external link, I retrieve 2 cases, success and error:
- Success: if the image library in the destination inherit the permission from the root site
- Error: If the image library has its own permission set (breaking inheritance)
The final presentation is a mix between the 2 cases
The strange point is the access permission is ok at the end, but not into that presentation mode:
So I will try to understand what is missing into the permission set.
Fab
- Success: if the image library in the destination inherit the permission from the root site
- BertJansen
Microsoft
When you create a page using the UI SharePoint will pick the first (preview) image it finds and uses that as the image to display the page in the news web part. If you programmatically create pages using the PnP client-side API (so using the .Net PnP Site Core library or using PnP Powershell) then you'll have a similar behavior as the API will try to pick the first image (via entries in the imageSources JSON node), although it's not as enhanced as the native feature.
If you want to change things you could look into setting the BannerImageUrl field. We use the following construct in our API implementation:
item[ClientSidePage.BannerImageUrl] = $"{rootUri}_layouts/15/getpreview.ashx?guidSite={site guid}&guidWeb={web guid}&guidFile={image guid}";
- FromelardIron Contributor
The issue is not into the Banner part, because the value is correctly loaded.
It's only the preview api which is refusing to show it in some mode.
I tried in another call model and it's OK:
From this URL:
- https://[mytenant].sharepoint.com/[mysubsite]/_layouts/15/getpreview.ashx?resolution=3&path=%2Fmysubsite%2Ffunctions%2Fcom%2Fpublishingimages%2Flatest%20emailing.business.jpg&clientType=modernWebPart
To this URL:
- https://[mytenant].sharepoint.com/[mysubsite]/_layouts/15/getpreview.ashx?clientType=docLibGrid&guidFile={5B19514D-5080-43C8-AF7A-092AF52ACF7C}&guidSite={1e4c2649-d8d9-4227-8716-3a6aa65121f3}&guidWeb={d749484e-d2dc-483d-9812-56c8390d44c8}&resolution=Width1024
Fab