forked from pnp/powershell
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ExecuteQueryRetry to Admin commands for improved reliability (
pnp#3988) Co-authored-by: Gautam Sheth <[email protected]>
- Loading branch information
1 parent
0d8c5ba
commit 1d475e7
Showing
4 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 15 additions & 13 deletions
28
src/Commands/Admin/UnlockSensitivityLabelEncryptedFile.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
using Microsoft.SharePoint.Client; | ||
using PnP.PowerShell.Commands.Base; | ||
using System.Management.Automation; | ||
|
||
namespace PnP.PowerShell.Commands.Files | ||
{ | ||
[Cmdlet(VerbsCommon.Unlock, "PnPSensitivityLabelEncryptedFile")] | ||
public class UnlockSensitivityLabelEncryptedFile : PnPAdminCmdlet | ||
[Cmdlet(VerbsCommon.Unlock, "PnPSensitivityLabelEncryptedFile")] | ||
public class UnlockSensitivityLabelEncryptedFile : PnPAdminCmdlet | ||
{ | ||
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] | ||
public string Url = string.Empty; | ||
|
||
[Parameter(Mandatory = true)] | ||
public string JustificationText = string.Empty; | ||
protected override void ExecuteCmdlet() | ||
{ | ||
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] | ||
public string Url = string.Empty; | ||
[Parameter(Mandatory = true)] | ||
public string JustificationText = string.Empty; | ||
protected override void ExecuteCmdlet() | ||
{ | ||
// Remove URL decoding from the Url as that will not work. We will encode the + character specifically, because if that is part of the filename, it needs to stay and not be decoded. | ||
Url = Utilities.UrlUtilities.UrlDecode(Url.Replace("+", "%2B")); | ||
// Remove URL decoding from the Url as that will not work. We will encode the + character specifically, because if that is part of the filename, it needs to stay and not be decoded. | ||
Url = Utilities.UrlUtilities.UrlDecode(Url.Replace("+", "%2B")); | ||
|
||
Tenant.UnlockSensitivityLabelEncryptedFile(Url, JustificationText); | ||
AdminContext.ExecuteQuery(); | ||
} | ||
Tenant.UnlockSensitivityLabelEncryptedFile(Url, JustificationText); | ||
AdminContext.ExecuteQueryRetry(); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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