Add the missing Office 365 geography codes - #1259
Open
svermaak wants to merge 1 commit into
Open
Conversation
Office365Geography carried 18 of the 30 PreferredDataLocation codes that Microsoft documents, so a tenant in one of the other twelve could not be addressed at all. Binding "NZL" fails with "Unable to match the identifier name NZL to a valid enumerator name", which is what a caller sees when it sets PreferredDataLocation for a New Zealand tenant. Adds AUT, CHL, DNK, ESP, IDN, ISR, ITA, MEX, MYS, NZL, POL and TWN, appended so the existing members keep their values. The value is sent on with ToString(), so the member name is the code and no mapping is needed. Adds a test that walks the documented code list, which turns the next missing geography into a failing test rather than a runtime bind error.
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.
Type of change
Related issue
Fixes #1170
What is in this Pull Request
Office365Geographyis the type behindPreferredDataLocationonSiteCollectionCreationInformation,CommunicationSiteCollectionCreationInformationand theUnifiedGroupsUtilitygroup creation overloads. It listed 18 of the 30 codes in the geo location table its own summary links to, so a tenant in one of the other twelve could not be addressed at all:Missing:
AUTAustria,CHLChile,DNKDenmark,ESPSpain,IDNIndonesia,ISRIsrael,ITAItaly,MEXMexico,MYSMalaysia,NZLNew Zealand,POLPoland,TWNTaiwan.The value reaches the service through
ToString()inSiteCollection.csandUnifiedGroupsUtility.cs, so the member name is the code itself and nothing else has to change. The new members are appended rather than sorted in, so every existing member keeps its numeric value.Source for the list is the table this enum already points at, geo location codes.
Verification
Binding each documented code to
Office365Geographyand checking it round trips throughToString(), plus thePreferredDataLocationassignment from the issue.Before, twelve codes cannot be bound and New Zealand throws:
After, all thirty bind and
PreferredDataLocation = NZLis accepted:Builds clean for
netstandard2.0,net8.0,net9.0andnet10.0.Regression test
Office365GeographyTests.EveryDocumentedGeoLocationCodeIsSupportedwalks the documented code list and reports the ones that are not usable, so the next geography Microsoft adds shows up as a failing test with the codes named rather than as a bind error at runtime. Verified both ways withdotnet test --filter FullyQualifiedName~Office365GeographyTests: ondevit fails listing the twelve, with this change it passes.No CHANGELOG entry included.