diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b3308a03..3860ea837 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Added ### Changed +- Changed fallback scenario for 'Get-PnPFile' where downloading a file created by a user that no longer exists would try a different technique to download the file. This only worked on English environments though. With this fix, it should work for any language. [PR #2852](https://github.com/pnp/PnP-PowerShell/pull/2852) ### Contributors +- Heinrich Ulbricht [heinrich-ulbricht] ## [3.26.2010.0] diff --git a/Commands/Files/GetFile.cs b/Commands/Files/GetFile.cs index 2b3849c75..b14af3b53 100644 --- a/Commands/Files/GetFile.cs +++ b/Commands/Files/GetFile.cs @@ -128,8 +128,9 @@ protected override void ExecuteCmdlet() ClientContext.Load(file, f => f.Author, f => f.Length, f => f.ModifiedBy, f => f.Name, f => f.TimeCreated, f => f.TimeLastModified, f => f.Title); ClientContext.ExecuteQueryRetry(); } - catch (ServerException e) when (e.Message == "User cannot be found.") + catch (ServerException) { + // Assume the cause of the exception is that a principal cannot be found and try again without: // Fallback in case the creator or person having last modified the file no longer exists in the environment such that the file can still be downloaded ClientContext.Load(file, f => f.Length, f => f.Name, f => f.TimeCreated, f => f.TimeLastModified, f => f.Title); ClientContext.ExecuteQueryRetry();