Add script to check and correct SPO Site Pages translation config#963
Open
fabianhutzli wants to merge 1 commit into
Open
Add script to check and correct SPO Site Pages translation config#963fabianhutzli wants to merge 1 commit into
fabianhutzli wants to merge 1 commit into
Conversation
Validates _SPTranslatedLanguages, _SPTranslationLanguage, _SPTranslationSourceItemId and _SPIsTranslation for every page in the Site Pages library across three roles (standalone, master, translated). Optionally corrects clear-cut misconfigurations via -Fix, including deriving a missing _SPTranslationLanguage from the master's language list and resolving a missing _SPTranslationSourceItemId from sibling pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This sample validates the SharePoint multilingual translation metadata for every page in the Site Pages library and optionally corrects clear-cut misconfigurations. It is useful when translation fields get out of sync — for example after manual page moves, bulk imports, or failed translation setups — and there is no easy way to identify the affected pages at scale.
The script classifies each page into one of three roles and checks the expected field state for each:
_SP*fields empty_SPIsTranslationis false_SPTranslatedLanguageslists exactly all translation languages; other fields empty_SPIsTranslationis true_SPTranslationLanguageand_SPTranslationSourceItemIdset;_SPTranslatedLanguagesemptyFeatures
UniqueId, and list item ID-Fixswitch): automatically corrects unambiguous cases:_SPTranslationLanguageon a translated page by subtracting languages claimed by sibling translations from the master's_SPTranslatedLanguageslist — fixable when exactly one language remains_SPTranslationSourceItemIdby finding the sole non-translation page that shares the same filename — fixable when exactly one candidate existsScript type
PnP PowerShell
Author
Fabian Hutzli