From e16084e821487452139aa30fd8ef0498a3b25602 Mon Sep 17 00:00:00 2001 From: Heinrich Ulbricht Date: Tue, 18 Aug 2020 07:38:19 +0200 Subject: [PATCH 1/2] fixing file not being able to retrieve if removed principals are present --- Commands/Files/GetFile.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); From a93d93f2f768d096a719bb830d610381cc758ee1 Mon Sep 17 00:00:00 2001 From: KoenZomers Date: Mon, 16 Nov 2020 12:31:46 +0100 Subject: [PATCH 2/2] Adding changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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]