Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Fixing how Get-PnPFile handles removed principals in non-English environments #2852

Conversation

heinrich-ulbricht
Copy link
Contributor

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

N/A

What is in this Pull Request ?

This PR allows to use Get-PnPFile for files where the author or modifier principal does not exist anymore in the environment. The PR removes the error message check that relies on an English environment. Unfortunately the error message can come back localized so this doesn't really work.

fyi @KoenZomers

@heinrich-ulbricht heinrich-ulbricht changed the title Fixing how Get-PnPFile handles removed principals in non-english environments Fixing how Get-PnPFile handles removed principals in non-English environments Aug 18, 2020
@heinrich-ulbricht
Copy link
Contributor Author

Ideally this would check the ServerErrorCode instead of the error message (or nothing like in this PR). But I'm not sure how reliable this would be - see the related question on Twitter: https://twitter.com/h_ulbricht/status/1295355161469231105?s=20

@KoenZomers
Copy link
Collaborator

Good point here @heinrich-ulbricht. Didn't think about the lovely localized error messages. I'm not sure myself how reliable the error codes will be. As the exception goes to a fallback scenario effectively still trying to perform the same operation, just without requesting the author field, I think we're okay with the approach you're suggesting here. If the exception would be thrown for other reasons and the same fallback doesn't fix it, it will still throw an exception in the catch and do the same as it would do today.

@KoenZomers KoenZomers removed their assignment Nov 16, 2020
@KoenZomers KoenZomers added the status:checked and ready for merge ✔ PR has been checked and is ready for merge label Nov 16, 2020
KoenZomers added a commit to KoenZomers/pnppowershell that referenced this pull request Nov 16, 2020
@erwinvanhunen erwinvanhunen merged commit 167880e into pnp:dev Dec 1, 2020
@erwinvanhunen
Copy link
Member

Thanks @heinrich-ulbricht !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:checked and ready for merge ✔ PR has been checked and is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants