Add Get-PnPGeoAdministrator cmdlet#5378
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new SharePoint Online admin cmdlet, Get-PnPGeoAdministrator, to retrieve tenant geo administrators via the existing MultiGeo REST client.
Changes:
- Added
Get-PnPGeoAdministratorcmdlet that calls the MultiGeo REST API and outputs geo administrator objects. - Extended
MultiGeoRestApiClientwith aGeoAdministratorsendpoint and minimum API version gating. - Added supporting models/enums plus cmdlet documentation and a changelog entry.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs | Adds GeoAdministrators REST call + api-version validation helper. |
| src/Commands/Model/GeoAdministratorCollection.cs | Adds internal wrapper model for the GeoAdministrators API response shape. |
| src/Commands/Model/GeoAdministrator.cs | Adds public output model representing a geo administrator. |
| src/Commands/Enums/GroupMemberType.cs | Adds enum used by GeoAdministrator.MemberType. |
| src/Commands/Admin/GetGeoAdministrator.cs | Adds the Get-PnPGeoAdministrator cmdlet implementation. |
| documentation/Get-PnPGeoAdministrator.md | Adds user-facing cmdlet documentation. |
| CHANGELOG.md | Adds an entry for the new cmdlet (but note the file’s own guidance about not committing changes). |
Comment on lines
+549
to
+558
| private string GetGeoAdministratorsApiVersion() | ||
| { | ||
| var apiVersion = GetCurrentApiVersion(); | ||
| if (!IsSupportedApiVersion(apiVersion, GeoAdministratorsMinimumApiVersion)) | ||
| { | ||
| throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, CommandResources.CrossGeoInvalidVersion, GetApplicationVersion())); | ||
| } | ||
|
|
||
| return apiVersion; | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
Leaving this as-is intentionally for SPO Management Shell parity. The decompiled GetSPOGeoAdministrator/MultiGeoRestApiClient.GetGeoAdministrators path checks support against V12Beta/1.2-beta and throws CrossGeoInvalidVersion with the application version. Using GetCurrentApiVersion(minimumApiVersion) would change the error text/behavior, which this PR is trying to match exactly.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Before creating a pull request, make sure that you have read the contribution file located at
https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md
Type
Related Issues?
N/A
What is in this Pull Request ?
Adds
Get-PnPGeoAdministratorto retrieve SharePoint Online geo administrators using the same MultiGeo REST endpoint as the SPO Management Shell cmdlet.The implementation reuses the existing
MultiGeoRestApiClient, adds theGeoAdministratorsAPI call with the SPO minimum API version1.2-beta, and returns output objects matching the SPO response shape:DisplayName,LoginName,MemberType,ObjectId, andGeoLocation. Documentation and the current nightly changelog are included.Guidance
N/A