From 9e8df0d7c4f258a4f266a7b052eb0e4cc828ab9f Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Sun, 31 May 2026 18:59:29 +0300 Subject: [PATCH] Add Get-PnPGeoMoveCrossCompatibilityStatus cmdlet and related models for geo move compatibility checks --- CHANGELOG.md | 1 + .../Get-PnPGeoMoveCrossCompatibilityStatus.md | 59 +++++++++++++++++++ .../GetGeoMoveCrossCompatibilityStatus.cs | 21 +++++++ .../Model/GeoMoveCompatibilityChecks.cs | 13 ++++ .../GeoMoveCompatibilityValidationResult.cs | 16 +++++ .../Model/GeoMoveTenantCompatibilityCheck.cs | 26 ++++++++ .../MultiGeo/MultiGeoRestApiClient.cs | 7 +++ 7 files changed, 143 insertions(+) create mode 100644 documentation/Get-PnPGeoMoveCrossCompatibilityStatus.md create mode 100644 src/Commands/Admin/GetGeoMoveCrossCompatibilityStatus.cs create mode 100644 src/Commands/Model/GeoMoveCompatibilityChecks.cs create mode 100644 src/Commands/Model/GeoMoveCompatibilityValidationResult.cs create mode 100644 src/Commands/Model/GeoMoveTenantCompatibilityCheck.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 53fec19d2..681fd03e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Added - Added `Get-PnPMultiGeoCompanyAllowedDataLocation` cmdlet to retrieve SharePoint Online multi-geo allowed data locations. [#5336](https://github.com/pnp/powershell/pull/5336) +- Added `Get-PnPGeoMoveCrossCompatibilityStatus` cmdlet to retrieve SharePoint Online multi-geo move compatibility statuses. ### Changed - Added properties `CoreOrganizationSharingLinkRecommendedExpirationInDays`, `CoreOrganizationSharingLinkMaxExpirationInDays`,`RestrictResourceAccountAccess`, `RestrictExternalSharingForAgents` to `Set-PnPTenant` and `Get-PnPTenant` cmdlet. [#5330](https://github.com/pnp/powershell/pull/5330) diff --git a/documentation/Get-PnPGeoMoveCrossCompatibilityStatus.md b/documentation/Get-PnPGeoMoveCrossCompatibilityStatus.md new file mode 100644 index 000000000..da58faff5 --- /dev/null +++ b/documentation/Get-PnPGeoMoveCrossCompatibilityStatus.md @@ -0,0 +1,59 @@ +--- +Module Name: PnP.PowerShell +title: Get-PnPGeoMoveCrossCompatibilityStatus +schema: 2.0.0 +applicable: SharePoint Online +external help file: PnP.PowerShell.dll-Help.xml +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPGeoMoveCrossCompatibilityStatus.html +--- + +# Get-PnPGeoMoveCrossCompatibilityStatus + +## SYNOPSIS +Returns compatibility statuses between SharePoint Online multi-geo locations. + +## SYNTAX + +```powershell +Get-PnPGeoMoveCrossCompatibilityStatus [-Connection ] +``` + +## DESCRIPTION +Returns the compatibility between source and destination data locations for site moves in a multi-geo SharePoint Online tenant. + +The returned status can be `Compatible`, `Incompatible`, `Warning`, or `Error`. + +## EXAMPLES + +### EXAMPLE 1 + +```powershell +Get-PnPGeoMoveCrossCompatibilityStatus +``` + +Returns the compatibility status for all source and destination geo location combinations. + +## PARAMETERS + +### -Connection +Optional connection to be used by the cmdlet. Retrieve the value for this parameter by specifying `-ReturnConnection` on `Connect-PnPOnline` or by executing `Get-PnPConnection`. + +```yaml +Type: PnPConnection +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## OUTPUTS + +### PnP.PowerShell.Commands.Model.GeoMoveTenantCompatibilityCheck +Returns objects with `SourceDataLocation`, `DestinationDataLocation`, and `GeoMoveTenantCompatibilityResult` properties. + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) \ No newline at end of file diff --git a/src/Commands/Admin/GetGeoMoveCrossCompatibilityStatus.cs b/src/Commands/Admin/GetGeoMoveCrossCompatibilityStatus.cs new file mode 100644 index 000000000..7b181de77 --- /dev/null +++ b/src/Commands/Admin/GetGeoMoveCrossCompatibilityStatus.cs @@ -0,0 +1,21 @@ +using PnP.PowerShell.Commands.Attributes; +using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Model; +using PnP.PowerShell.Commands.Utilities.MultiGeo; +using System.Management.Automation; + +namespace PnP.PowerShell.Commands.Admin +{ + [Cmdlet(VerbsCommon.Get, "PnPGeoMoveCrossCompatibilityStatus")] + [RequiredApiApplicationPermissions("sharepoint/Sites.FullControl.All")] + [RequiredApiDelegatedPermissions("sharepoint/AllSites.FullControl")] + [OutputType(typeof(GeoMoveTenantCompatibilityCheck))] + public class GetGeoMoveCrossCompatibilityStatus : PnPSharePointOnlineAdminCmdlet + { + protected override void ExecuteCmdlet() + { + var multiGeoRestApiClient = new MultiGeoRestApiClient(AdminContext); + WriteObject(multiGeoRestApiClient.GetGeoMoveCompatibilityChecks(), true); + } + } +} \ No newline at end of file diff --git a/src/Commands/Model/GeoMoveCompatibilityChecks.cs b/src/Commands/Model/GeoMoveCompatibilityChecks.cs new file mode 100644 index 000000000..4e1fc88a6 --- /dev/null +++ b/src/Commands/Model/GeoMoveCompatibilityChecks.cs @@ -0,0 +1,13 @@ +namespace PnP.PowerShell.Commands.Model +{ + /// + /// Contains SharePoint Online multi-geo move compatibility checks. + /// + public class GeoMoveCompatibilityChecks + { + /// + /// Compatibility checks between source and destination geo locations. + /// + public GeoMoveTenantCompatibilityCheck[] GeoMoveTenantCompatibilityChecks { get; set; } + } +} \ No newline at end of file diff --git a/src/Commands/Model/GeoMoveCompatibilityValidationResult.cs b/src/Commands/Model/GeoMoveCompatibilityValidationResult.cs new file mode 100644 index 000000000..05ba7e48e --- /dev/null +++ b/src/Commands/Model/GeoMoveCompatibilityValidationResult.cs @@ -0,0 +1,16 @@ +namespace PnP.PowerShell.Commands.Model +{ + /// + /// Indicates whether a SharePoint Online multi-geo move can be performed between locations. + /// + public enum GeoMoveCompatibilityValidationResult + { + Compatible = 0, + + Incompatible = 1, + + Warning = 2, + + Error = 3 + } +} \ No newline at end of file diff --git a/src/Commands/Model/GeoMoveTenantCompatibilityCheck.cs b/src/Commands/Model/GeoMoveTenantCompatibilityCheck.cs new file mode 100644 index 000000000..62b1a6498 --- /dev/null +++ b/src/Commands/Model/GeoMoveTenantCompatibilityCheck.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model +{ + /// + /// Contains the compatibility status for moving SharePoint Online sites between two geo locations. + /// + public class GeoMoveTenantCompatibilityCheck + { + /// + /// Source geo location code. + /// + public string SourceDataLocation { get; set; } + + /// + /// Destination geo location code. + /// + public string DestinationDataLocation { get; set; } + + /// + /// Compatibility status for moves between the source and destination geo locations. + /// + [JsonConverter(typeof(JsonStringEnumConverter))] + public GeoMoveCompatibilityValidationResult GeoMoveTenantCompatibilityResult { get; set; } + } +} \ No newline at end of file diff --git a/src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs b/src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs index 1cf5531f2..bc75dfe12 100644 --- a/src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs +++ b/src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs @@ -23,6 +23,8 @@ internal class MultiGeoRestApiClient private const string TenantRenameJobsPathToGetStatus = "TenantRenameJobs/Get"; private const string TenantRenameJobsPathToGetStatusV2 = "TenantRenameJobs/GetV2"; private const string TenantRenameJobsPathToCancelAJob = "TenantRenameJobs/Cancel"; + private const string GeoMoveCompatibilityChecksApiVersion = "1.3.6"; + private const string GeoMoveCompatibilityChecksPath = "GeoMoveCompatibilityChecks"; private const string AllowedDataLocationsApiVersion = "1.3.11"; private const string AllowedDataLocationsPath = "AllowedDataLocations"; private const int MaximumPagination = 10; @@ -61,6 +63,11 @@ internal IEnumerable GetTenantRenameWarningMessages() return GetFeed(TenantRenameJobsPathToGetWarningMessages, TenantRenameApiVersion); } + internal IEnumerable GetGeoMoveCompatibilityChecks() + { + return Get(GeoMoveCompatibilityChecksPath, GeoMoveCompatibilityChecksApiVersion)?.GeoMoveTenantCompatibilityChecks ?? Array.Empty(); + } + internal IEnumerable GetAllowedDataLocations() { return GetFeed(AllowedDataLocationsPath, AllowedDataLocationsApiVersion);