You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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 recognizeable as image (is 125KB, vs the actual image is 49 KB).
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions