Skip to content

Commit 497f994

Browse files
authored
Add Get-PnPGeoMoveCrossCompatibilityStatus cmdlet and related models for geo move compatibility checks (#5337)
1 parent c878400 commit 497f994

7 files changed

Lines changed: 143 additions & 0 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1010

1111
### Added
1212
- Added `Get-PnPMultiGeoCompanyAllowedDataLocation` cmdlet to retrieve SharePoint Online multi-geo allowed data locations. [#5336](https://github.com/pnp/powershell/pull/5336)
13+
- Added `Get-PnPGeoMoveCrossCompatibilityStatus` cmdlet to retrieve SharePoint Online multi-geo move compatibility statuses.
1314

1415
### Changed
1516
- Added properties `CoreOrganizationSharingLinkRecommendedExpirationInDays`, `CoreOrganizationSharingLinkMaxExpirationInDays`,`RestrictResourceAccountAccess`, `RestrictExternalSharingForAgents` to `Set-PnPTenant` and `Get-PnPTenant` cmdlet. [#5330](https://github.com/pnp/powershell/pull/5330)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
title: Get-PnPGeoMoveCrossCompatibilityStatus
4+
schema: 2.0.0
5+
applicable: SharePoint Online
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPGeoMoveCrossCompatibilityStatus.html
8+
---
9+
10+
# Get-PnPGeoMoveCrossCompatibilityStatus
11+
12+
## SYNOPSIS
13+
Returns compatibility statuses between SharePoint Online multi-geo locations.
14+
15+
## SYNTAX
16+
17+
```powershell
18+
Get-PnPGeoMoveCrossCompatibilityStatus [-Connection <PnPConnection>]
19+
```
20+
21+
## DESCRIPTION
22+
Returns the compatibility between source and destination data locations for site moves in a multi-geo SharePoint Online tenant.
23+
24+
The returned status can be `Compatible`, `Incompatible`, `Warning`, or `Error`.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
30+
```powershell
31+
Get-PnPGeoMoveCrossCompatibilityStatus
32+
```
33+
34+
Returns the compatibility status for all source and destination geo location combinations.
35+
36+
## PARAMETERS
37+
38+
### -Connection
39+
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`.
40+
41+
```yaml
42+
Type: PnPConnection
43+
Parameter Sets: (All)
44+
45+
Required: False
46+
Position: Named
47+
Default value: None
48+
Accept pipeline input: False
49+
Accept wildcard characters: False
50+
```
51+
52+
## OUTPUTS
53+
54+
### PnP.PowerShell.Commands.Model.GeoMoveTenantCompatibilityCheck
55+
Returns objects with `SourceDataLocation`, `DestinationDataLocation`, and `GeoMoveTenantCompatibilityResult` properties.
56+
57+
## RELATED LINKS
58+
59+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using PnP.PowerShell.Commands.Attributes;
2+
using PnP.PowerShell.Commands.Base;
3+
using PnP.PowerShell.Commands.Model;
4+
using PnP.PowerShell.Commands.Utilities.MultiGeo;
5+
using System.Management.Automation;
6+
7+
namespace PnP.PowerShell.Commands.Admin
8+
{
9+
[Cmdlet(VerbsCommon.Get, "PnPGeoMoveCrossCompatibilityStatus")]
10+
[RequiredApiApplicationPermissions("sharepoint/Sites.FullControl.All")]
11+
[RequiredApiDelegatedPermissions("sharepoint/AllSites.FullControl")]
12+
[OutputType(typeof(GeoMoveTenantCompatibilityCheck))]
13+
public class GetGeoMoveCrossCompatibilityStatus : PnPSharePointOnlineAdminCmdlet
14+
{
15+
protected override void ExecuteCmdlet()
16+
{
17+
var multiGeoRestApiClient = new MultiGeoRestApiClient(AdminContext);
18+
WriteObject(multiGeoRestApiClient.GetGeoMoveCompatibilityChecks(), true);
19+
}
20+
}
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace PnP.PowerShell.Commands.Model
2+
{
3+
/// <summary>
4+
/// Contains SharePoint Online multi-geo move compatibility checks.
5+
/// </summary>
6+
public class GeoMoveCompatibilityChecks
7+
{
8+
/// <summary>
9+
/// Compatibility checks between source and destination geo locations.
10+
/// </summary>
11+
public GeoMoveTenantCompatibilityCheck[] GeoMoveTenantCompatibilityChecks { get; set; }
12+
}
13+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace PnP.PowerShell.Commands.Model
2+
{
3+
/// <summary>
4+
/// Indicates whether a SharePoint Online multi-geo move can be performed between locations.
5+
/// </summary>
6+
public enum GeoMoveCompatibilityValidationResult
7+
{
8+
Compatible = 0,
9+
10+
Incompatible = 1,
11+
12+
Warning = 2,
13+
14+
Error = 3
15+
}
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace PnP.PowerShell.Commands.Model
4+
{
5+
/// <summary>
6+
/// Contains the compatibility status for moving SharePoint Online sites between two geo locations.
7+
/// </summary>
8+
public class GeoMoveTenantCompatibilityCheck
9+
{
10+
/// <summary>
11+
/// Source geo location code.
12+
/// </summary>
13+
public string SourceDataLocation { get; set; }
14+
15+
/// <summary>
16+
/// Destination geo location code.
17+
/// </summary>
18+
public string DestinationDataLocation { get; set; }
19+
20+
/// <summary>
21+
/// Compatibility status for moves between the source and destination geo locations.
22+
/// </summary>
23+
[JsonConverter(typeof(JsonStringEnumConverter))]
24+
public GeoMoveCompatibilityValidationResult GeoMoveTenantCompatibilityResult { get; set; }
25+
}
26+
}

‎src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ internal class MultiGeoRestApiClient
2323
private const string TenantRenameJobsPathToGetStatus = "TenantRenameJobs/Get";
2424
private const string TenantRenameJobsPathToGetStatusV2 = "TenantRenameJobs/GetV2";
2525
private const string TenantRenameJobsPathToCancelAJob = "TenantRenameJobs/Cancel";
26+
private const string GeoMoveCompatibilityChecksApiVersion = "1.3.6";
27+
private const string GeoMoveCompatibilityChecksPath = "GeoMoveCompatibilityChecks";
2628
private const string AllowedDataLocationsApiVersion = "1.3.11";
2729
private const string AllowedDataLocationsPath = "AllowedDataLocations";
2830
private const int MaximumPagination = 10;
@@ -61,6 +63,11 @@ internal IEnumerable<string> GetTenantRenameWarningMessages()
6163
return GetFeed<string>(TenantRenameJobsPathToGetWarningMessages, TenantRenameApiVersion);
6264
}
6365

66+
internal IEnumerable<GeoMoveTenantCompatibilityCheck> GetGeoMoveCompatibilityChecks()
67+
{
68+
return Get<GeoMoveCompatibilityChecks>(GeoMoveCompatibilityChecksPath, GeoMoveCompatibilityChecksApiVersion)?.GeoMoveTenantCompatibilityChecks ?? Array.Empty<GeoMoveTenantCompatibilityCheck>();
69+
}
70+
6471
internal IEnumerable<MultiGeoCompanyAllowedDataLocation> GetAllowedDataLocations()
6572
{
6673
return GetFeed<MultiGeoCompanyAllowedDataLocation>(AllowedDataLocationsPath, AllowedDataLocationsApiVersion);

0 commit comments

Comments
 (0)