I'm trying to fix the language of a PnP PowerShell request. Specifically, I'd like to extract site scripts from a web in a neutral language.
Here's what I tried :
$cnx = Connect-PnPOnline -ReturnConnection ` -Url https://somewhere.sharepoint.com/sites/overtherainbow ` -ClientId a165e590-a591-4897-cd27-929ccddb9908 ` -ClientSecret "supersecret" Register-ObjectEvent -InputObject $cnx.Context -EventName ExecutingWebRequest -Action { param( [object]$sender, [Microsoft.SharePoint.Client.WebRequestEventArgs]$args ) [void] $args.WebRequestExecutor.WebRequest.Headers.Add("Accept-Language", "en-us") } Get-PnPSiteScriptFromList -Url https://somewhere.sharepoint.com/sites/overtherainbow/SitePages -Connection $cnx However, the result isn't in english, but in the default site language.
Monitoring the network using Fiddler doesn't show the expected header at all.
How to fix that ? Is there an alternative to reach my goal ?
PS: if I try to execute the REST method using Insomnia, I get what I want to achieve. The header is present