Replies: 1 comment
-
I download images from the search result property 'BannerImageUrlOWSURLH'.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Invoke-PnPSPRestMethod to download the contents of a thumbnail image file (for SPO News articles). SharePoint looks to be storing the image in a link similar to below (shortened for simplicity)
$url1 = https://tenant.sharepoint.com/_api/v2.1/shares/.../driveItem/thumbnails/0/c400x99999/content?preferNoRedirect=true"
Using the following
$output = Invoke-PnPSPRestMethod -url1 $picFile -ContentType 'application/octet-stream'
I get the following error.
Message : {"error":{"code":"notAcceptable","message":"Accept header cannot be satisfied (Accept: 'application/json; odata=nometadata', Content-Type: 'image/png')"}}
I am able to retrieve content with the following (removed the redirect at end of the link)
$url2 = https://tenant.sharepoint.com/_api/v2.1/shares/.../driveItem/thumbnails/0/c400x99999/content"
$output = Invoke-PnPSPRestMethod -url $url2 -Raw
$output | Out-File -FilePath C:\temp\pic.png
In this case the pic.png is not recognizable as image (is 125KB, vs the actual image is 49 KB).
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions