From f97d8eb8f780fa78cbcb2fbae222373c4d65b53d Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 28 Feb 2024 13:24:09 -0800 Subject: [PATCH 01/21] Add file what if. --- src/Commands/Files/GetFileVersion.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Commands/Files/GetFileVersion.cs b/src/Commands/Files/GetFileVersion.cs index 2fdff4045..bc9d36100 100644 --- a/src/Commands/Files/GetFileVersion.cs +++ b/src/Commands/Files/GetFileVersion.cs @@ -13,6 +13,9 @@ public class GetFileVersion : PnPWebCmdlet [Parameter(Mandatory = true)] public string Url; + [Parameter(Mandatory = false)] + public SwitchParameter? UseVersionExpirationReport; + protected override void ExecuteCmdlet() { var serverRelativeUrl = string.Empty; @@ -31,13 +34,23 @@ protected override void ExecuteCmdlet() File file; file = CurrentWeb.GetFileByServerRelativePath(ResourcePath.FromDecodedUrl(serverRelativeUrl)); + + var doesUseVersionExpirationReport = UseVersionExpirationReport.HasValue && UseVersionExpirationReport.Value; + + if (doesUseVersionExpirationReport) + { + ClientContext.Load(file, f => f.Exists, f => f.VersionExpirationReport.IncludeWithDefaultProperties(i => i.CreatedBy, i => i.SnapshotDate, i => i.ExpirationDate)); + } + else + { + ClientContext.Load(file, f => f.Exists, f => f.Versions.IncludeWithDefaultProperties(i => i.CreatedBy, i => i.SnapshotDate, i => i.ExpirationDate)); + } - ClientContext.Load(file, f => f.Exists, f => f.Versions.IncludeWithDefaultProperties(i => i.CreatedBy)); ClientContext.ExecuteQueryRetry(); if (file.Exists) { - var versions = file.Versions; + var versions = doesUseVersionExpirationReport ? file.VersionExpirationReport : file.Versions; ClientContext.ExecuteQueryRetry(); WriteObject(versions, true); } From f70b5673c39d02afc2a2440dc014b69d53745860 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 28 Feb 2024 16:33:12 -0800 Subject: [PATCH 02/21] Add batch delete cmdlets. --- .../NewListLevelFileVersionBatchDeleteJob.cs | 44 +++++++++++++++++++ ...emoveListLevelFileVersionBatchDeleteJob.cs | 41 +++++++++++++++++ .../NewSiteLevelFileVersionBatchDeleteJob.cs | 37 ++++++++++++++++ ...emoveSiteLevelFileVersionBatchDeleteJob.cs | 34 ++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs create mode 100644 src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs create mode 100644 src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs create mode 100644 src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs diff --git a/src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs new file mode 100644 index 000000000..52644a112 --- /dev/null +++ b/src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs @@ -0,0 +1,44 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Lists +{ + [Cmdlet(VerbsCommon.New, "ListLevelFileVersionBatchDeleteJob")] + public class NewListLevelFileVersionBatchDeleteJob : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] + [ValidateNotNull] + public ListPipeBind Identity; + + [Parameter(Mandatory = true)] + public int DeleteBeforeDays; + + [Parameter(Mandatory = false)] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Force || ShouldContinue("By executing this command, versions specified will be permanently deleted. These versions cannot be restored from the recycle bin. Are you sure you want to continue?", Resources.Confirm)) + { + var list = Identity.GetList(CurrentWeb); + if (list != null) + { + list.StartDeleteFileVersions(DeleteBeforeDays); + ClientContext.ExecuteQueryRetry(); + } + + WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); + } + else + { + WriteVerbose("Cancelled. No versions will be deleted."); + } + } + } +} diff --git a/src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs new file mode 100644 index 000000000..7eb6a1bbf --- /dev/null +++ b/src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs @@ -0,0 +1,41 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Lists +{ + [Cmdlet(VerbsCommon.Remove, "ListLevelFileVersionBatchDeleteJob")] + public class RemoveListLevelFileVersionBatchDeleteJob : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] + [ValidateNotNull] + public ListPipeBind Identity; + + [Parameter(Mandatory = false)] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Force || ShouldContinue("It will stop processing further version deletion batches. Are you sure you want to continue?", Resources.Confirm)) + { + var list = Identity.GetList(CurrentWeb); + if (list != null) + { + list.CancelDeleteFileVersions(); + ClientContext.ExecuteQueryRetry(); + } + + WriteVerbose("Future deletion is successfully stopped."); + } + else + { + WriteVerbose("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); + } + } + } +} diff --git a/src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs b/src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs new file mode 100644 index 000000000..6381f8860 --- /dev/null +++ b/src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs @@ -0,0 +1,37 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Sites +{ + [Cmdlet(VerbsCommon.New, "SiteLevelFileVersionBatchDeleteJob")] + public class NewSiteLevelFileVersionBatchDeleteJob : PnPSharePointCmdlet + { + [Parameter(Mandatory = true)] + public int DeleteBeforeDays; + + [Parameter(Mandatory = false)] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Force || ShouldContinue("By executing this command, versions specified will be permanently deleted. These versions cannot be restored from the recycle bin. Are you sure you want to continue?", Resources.Confirm)) + { + var site = ClientContext.Site; + site.StartDeleteFileVersions(DeleteBeforeDays); + ClientContext.ExecuteQueryRetry(); + + WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); + } + else + { + WriteVerbose("Cancelled. No versions will be deleted."); + } + } + } +} diff --git a/src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs b/src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs new file mode 100644 index 000000000..54bc2376d --- /dev/null +++ b/src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs @@ -0,0 +1,34 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Sites +{ + [Cmdlet(VerbsCommon.Remove, "SiteLevelFileVersionBatchDeleteJob")] + public class RemoveSiteLevelFileVersionBatchDeleteJob : PnPSharePointCmdlet + { + [Parameter(Mandatory = false)] + public SwitchParameter Force; + + protected override void ExecuteCmdlet() + { + if (Force || ShouldContinue("It will stop processing further version deletion batches. Are you sure you want to continue?", Resources.Confirm)) + { + var site = ClientContext.Site; + site.CancelDeleteFileVersions(); + ClientContext.ExecuteQueryRetry(); + + WriteVerbose("Future deletion is successfully stopped."); + } + else + { + WriteVerbose("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); + } + } + } +} From 1eada02eb4d090e71fac1b19fa09e1f36c5d6364 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 10:57:45 -0800 Subject: [PATCH 03/21] Renaming list to library. --- ...leteJob.cs => NewLibraryLevelFileVersionBatchDeleteJob.cs} | 4 ++-- ...eJob.cs => RemoveLibraryLevelFileVersionBatchDeleteJob.cs} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/Commands/Lists/{NewListLevelFileVersionBatchDeleteJob.cs => NewLibraryLevelFileVersionBatchDeleteJob.cs} (90%) rename src/Commands/Lists/{RemoveListLevelFileVersionBatchDeleteJob.cs => RemoveLibraryLevelFileVersionBatchDeleteJob.cs} (89%) diff --git a/src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs similarity index 90% rename from src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs index 52644a112..5a3d210d3 100644 --- a/src/Commands/Lists/NewListLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.New, "ListLevelFileVersionBatchDeleteJob")] - public class NewListLevelFileVersionBatchDeleteJob : PnPWebCmdlet + [Cmdlet(VerbsCommon.New, "LibraryLevelFileVersionBatchDeleteJob")] + public class NewLibraryLevelFileVersionBatchDeleteJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] diff --git a/src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs similarity index 89% rename from src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs index 7eb6a1bbf..65869bd90 100644 --- a/src/Commands/Lists/RemoveListLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.Remove, "ListLevelFileVersionBatchDeleteJob")] - public class RemoveListLevelFileVersionBatchDeleteJob : PnPWebCmdlet + [Cmdlet(VerbsCommon.Remove, "LibrarytLevelFileVersionBatchDeleteJob")] + public class RemoveLibraryLevelFileVersionBatchDeleteJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] From 498293738eb70b3cbcf9c3dab5b98b298757b73b Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 11:10:07 -0800 Subject: [PATCH 04/21] Add report cmdlets; fix small formatting issue. --- ...lFileVersionExpirationReportJobProgress.cs | 33 ++++++++++++++++++ ...ewLibraryLevelFileVersionBatchDeleteJob.cs | 4 +-- ...raryLevelFileVersionExpirationReportJob.cs | 34 +++++++++++++++++++ ...lFileVersionExpirationReportJobProgress.cs | 26 ++++++++++++++ ...SiteLevelFileVersionExpirationReportJob.cs | 27 +++++++++++++++ 5 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs create mode 100644 src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs create mode 100644 src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs create mode 100644 src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs diff --git a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs new file mode 100644 index 000000000..f3e85ccbb --- /dev/null +++ b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs @@ -0,0 +1,33 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Lists +{ + [Cmdlet(VerbsCommon.Get, "LibraryLevelFileVersionExpirationReportJobProgress")] + public class GetLibraryLevelFileVersionExpirationReportJobProgress : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] + [ValidateNotNull] + public ListPipeBind Identity; + + [Parameter(Mandatory = true)] + public string ReportUrl; + + protected override void ExecuteCmdlet() + { + var list = Identity.GetList(CurrentWeb); + if (list != null) + { + var status = list.GetProgressForFileVersionExpirationReport(ReportUrl); + ClientContext.ExecuteQueryRetry(); + WriteObject(status); + } + } + } +} diff --git a/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs index 5a3d210d3..1a6c22b21 100644 --- a/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs @@ -31,9 +31,9 @@ protected override void ExecuteCmdlet() { list.StartDeleteFileVersions(DeleteBeforeDays); ClientContext.ExecuteQueryRetry(); + + WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); } - - WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); } else { diff --git a/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs b/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs new file mode 100644 index 000000000..10d5afc61 --- /dev/null +++ b/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs @@ -0,0 +1,34 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Lists +{ + [Cmdlet(VerbsCommon.New, "LibraryLevelFileVersionExpirationReportJob")] + public class NewLibraryLevelFileVersionExpirationReportJob : PnPWebCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] + [ValidateNotNull] + public ListPipeBind Identity; + + [Parameter(Mandatory = true)] + public string ReportUrl; + + protected override void ExecuteCmdlet() + { + var list = Identity.GetList(CurrentWeb); + if (list != null) + { + list.StartFileVersionExpirationReport(ReportUrl); + ClientContext.ExecuteQueryRetry(); + + WriteVerbose("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small library, and a few days for a larger one."); + } + } + } +} diff --git a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs new file mode 100644 index 000000000..aeda890da --- /dev/null +++ b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs @@ -0,0 +1,26 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Sites +{ + [Cmdlet(VerbsCommon.Get, "SiteLevelFileVersionExpirationReportJobProgress")] + public class GetSiteLevelFileVersionExpirationReportJobProgress : PnPSharePointCmdlet + { + [Parameter(Mandatory = true)] + public string ReportUrl; + + protected override void ExecuteCmdlet() + { + var site = ClientContext.Site; + var status = site.GetProgressForFileVersionExpirationReport(ReportUrl); + ClientContext.ExecuteQueryRetry(); + WriteObject(status); + } + } +} diff --git a/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs b/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs new file mode 100644 index 000000000..55a8f1f71 --- /dev/null +++ b/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs @@ -0,0 +1,27 @@ +using Microsoft.SharePoint.Client; + +using PnP.Framework.Utilities; +using PnP.PowerShell.Commands.Base.PipeBinds; + +using System.Management.Automation; + +using Resources = PnP.PowerShell.Commands.Properties.Resources; + +namespace PnP.PowerShell.Commands.Sites +{ + [Cmdlet(VerbsCommon.New, "SiteLevelFileVersionExpirationReportJob")] + public class NewSiteLevelFileVersionExpirationReportJob : PnPSharePointCmdlet + { + [Parameter(Mandatory = true)] + public string ReportUrl; + + protected override void ExecuteCmdlet() + { + var site = ClientContext.Site; + site.StartFileVersionExpirationReport(ReportUrl); + ClientContext.ExecuteQueryRetry(); + + WriteVerbose("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small site, and a few days for a larger one."); + } + } +} From cadc2d48bdbc779b758ed1d7360290e1b6309a95 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 11:24:32 -0800 Subject: [PATCH 05/21] Fix typo. --- .../Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs index 65869bd90..4f57cbe54 100644 --- a/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs @@ -9,7 +9,7 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.Remove, "LibrarytLevelFileVersionBatchDeleteJob")] + [Cmdlet(VerbsCommon.Remove, "LibraryLevelFileVersionBatchDeleteJob")] public class RemoveLibraryLevelFileVersionBatchDeleteJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] From 824455d91db92d9937bea51ee60aab5c2f5d05d5 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 13:13:31 -0800 Subject: [PATCH 06/21] Add output types; remove unneeded import. --- .../GetLibraryLevelFileVersionExpirationReportJobProgress.cs | 3 +-- .../Lists/NewLibraryLevelFileVersionExpirationReportJob.cs | 2 -- .../Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs | 3 +-- .../Site/NewSiteLevelFileVersionExpirationReportJob.cs | 2 -- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs index f3e85ccbb..a096ec580 100644 --- a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs @@ -5,11 +5,10 @@ using System.Management.Automation; -using Resources = PnP.PowerShell.Commands.Properties.Resources; - namespace PnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.Get, "LibraryLevelFileVersionExpirationReportJobProgress")] + [OutputType(typeof(string))] public class GetLibraryLevelFileVersionExpirationReportJobProgress : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] diff --git a/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs b/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs index 10d5afc61..64c4f3daa 100644 --- a/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs +++ b/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs @@ -5,8 +5,6 @@ using System.Management.Automation; -using Resources = PnP.PowerShell.Commands.Properties.Resources; - namespace PnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.New, "LibraryLevelFileVersionExpirationReportJob")] diff --git a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs index aeda890da..6c96f5340 100644 --- a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs @@ -5,11 +5,10 @@ using System.Management.Automation; -using Resources = PnP.PowerShell.Commands.Properties.Resources; - namespace PnP.PowerShell.Commands.Sites { [Cmdlet(VerbsCommon.Get, "SiteLevelFileVersionExpirationReportJobProgress")] + [OutputType(typeof(string))] public class GetSiteLevelFileVersionExpirationReportJobProgress : PnPSharePointCmdlet { [Parameter(Mandatory = true)] diff --git a/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs b/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs index 55a8f1f71..a3fca6ae2 100644 --- a/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs +++ b/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs @@ -5,8 +5,6 @@ using System.Management.Automation; -using Resources = PnP.PowerShell.Commands.Properties.Resources; - namespace PnP.PowerShell.Commands.Sites { [Cmdlet(VerbsCommon.New, "SiteLevelFileVersionExpirationReportJob")] From 0ef654c94e2c928b6d482e1fc06ee7f452dbf9f2 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 13:36:18 -0800 Subject: [PATCH 07/21] Switch param update. --- src/Commands/Files/GetFileVersion.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Commands/Files/GetFileVersion.cs b/src/Commands/Files/GetFileVersion.cs index bc9d36100..952c4db2d 100644 --- a/src/Commands/Files/GetFileVersion.cs +++ b/src/Commands/Files/GetFileVersion.cs @@ -14,7 +14,7 @@ public class GetFileVersion : PnPWebCmdlet public string Url; [Parameter(Mandatory = false)] - public SwitchParameter? UseVersionExpirationReport; + public SwitchParameter UseVersionExpirationReport; protected override void ExecuteCmdlet() { @@ -34,10 +34,8 @@ protected override void ExecuteCmdlet() File file; file = CurrentWeb.GetFileByServerRelativePath(ResourcePath.FromDecodedUrl(serverRelativeUrl)); - - var doesUseVersionExpirationReport = UseVersionExpirationReport.HasValue && UseVersionExpirationReport.Value; - - if (doesUseVersionExpirationReport) + + if (UseVersionExpirationReport) { ClientContext.Load(file, f => f.Exists, f => f.VersionExpirationReport.IncludeWithDefaultProperties(i => i.CreatedBy, i => i.SnapshotDate, i => i.ExpirationDate)); } @@ -50,7 +48,7 @@ protected override void ExecuteCmdlet() if (file.Exists) { - var versions = doesUseVersionExpirationReport ? file.VersionExpirationReport : file.Versions; + var versions = UseVersionExpirationReport ? file.VersionExpirationReport : file.Versions; ClientContext.ExecuteQueryRetry(); WriteObject(versions, true); } From 2faa41f7cb4437bfa7795ad1fc7b6a33d152b0b5 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 14:39:23 -0800 Subject: [PATCH 08/21] Improve progress object. --- ...lFileVersionExpirationReportJobProgress.cs | 11 ++++-- .../FileVersionExpirationReportJobProgress.cs | 34 +++++++++++++++++++ ...lFileVersionExpirationReportJobProgress.cs | 12 +++++-- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/Commands/Model/SharePoint/FileVersionExpirationReportJobProgress.cs diff --git a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs index a096ec580..81c46f6dc 100644 --- a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs @@ -2,13 +2,15 @@ using PnP.Framework.Utilities; using PnP.PowerShell.Commands.Base.PipeBinds; +using PnP.PowerShell.Commands.Model.SharePoint; using System.Management.Automation; +using System.Text.Json; namespace PnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.Get, "LibraryLevelFileVersionExpirationReportJobProgress")] - [OutputType(typeof(string))] + [OutputType(typeof(FileVersionExpirationReportJobProgress))] public class GetLibraryLevelFileVersionExpirationReportJobProgress : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] @@ -23,8 +25,13 @@ protected override void ExecuteCmdlet() var list = Identity.GetList(CurrentWeb); if (list != null) { - var status = list.GetProgressForFileVersionExpirationReport(ReportUrl); + var ret = list.GetProgressForFileVersionExpirationReport(ReportUrl); ClientContext.ExecuteQueryRetry(); + + var status = JsonSerializer.Deserialize(ret.Value); + status.Url = list.RootFolder.ServerRelativeUrl; + status.ReportUrl = ReportUrl; + WriteObject(status); } } diff --git a/src/Commands/Model/SharePoint/FileVersionExpirationReportJobProgress.cs b/src/Commands/Model/SharePoint/FileVersionExpirationReportJobProgress.cs new file mode 100644 index 000000000..c4eea7baa --- /dev/null +++ b/src/Commands/Model/SharePoint/FileVersionExpirationReportJobProgress.cs @@ -0,0 +1,34 @@ +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.SharePoint +{ + /// + /// The progress for generating the file version expiration report. + /// + public class FileVersionExpirationReportJobProgress + { + /// + /// The URL to the site or library that the report is for + /// + [JsonPropertyName("url")] + public string Url { get; set; } + + /// + /// The URL of the report file + /// + [JsonPropertyName("report_url")] + public string ReportUrl { get; set; } + + /// + /// The request status + /// + [JsonPropertyName("status")] + public string Status { get; set; } + + /// + /// The error message if any + /// + [JsonPropertyName( "error_message")] + public string ErrorMessage { get; set; } + } +} diff --git a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs index 6c96f5340..386c089e9 100644 --- a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs @@ -2,13 +2,15 @@ using PnP.Framework.Utilities; using PnP.PowerShell.Commands.Base.PipeBinds; +using PnP.PowerShell.Commands.Model.SharePoint; using System.Management.Automation; +using System.Text.Json; namespace PnP.PowerShell.Commands.Sites { [Cmdlet(VerbsCommon.Get, "SiteLevelFileVersionExpirationReportJobProgress")] - [OutputType(typeof(string))] + [OutputType(typeof(FileVersionExpirationReportJobProgress))] public class GetSiteLevelFileVersionExpirationReportJobProgress : PnPSharePointCmdlet { [Parameter(Mandatory = true)] @@ -17,8 +19,14 @@ public class GetSiteLevelFileVersionExpirationReportJobProgress : PnPSharePointC protected override void ExecuteCmdlet() { var site = ClientContext.Site; - var status = site.GetProgressForFileVersionExpirationReport(ReportUrl); + ClientContext.Load(site, s => s.Url); + var ret = site.GetProgressForFileVersionExpirationReport(ReportUrl); ClientContext.ExecuteQueryRetry(); + + var status = JsonSerializer.Deserialize(ret.Value); + status.Url = site.Url; + status.ReportUrl = ReportUrl; + WriteObject(status); } } From e9023ac7b13c8855e9dceab01cb3340f43ffbeab Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 14:57:22 -0800 Subject: [PATCH 09/21] Update cmdlet names. --- ...cs => GetLibraryFileVersionExpirationReportJobProgress.cs} | 4 ++-- ...tchDeleteJob.cs => NewLibraryFileVersionBatchDeleteJob.cs} | 4 ++-- ...portJob.cs => NewLibraryFileVersionExpirationReportJob.cs} | 4 ++-- ...DeleteJob.cs => RemoveLibraryFileVersionBatchDeleteJob.cs} | 4 ++-- ...ss.cs => GetSiteFileVersionExpirationReportJobProgress.cs} | 4 ++-- ...nBatchDeleteJob.cs => NewSiteFileVersionBatchDeleteJob.cs} | 4 ++-- ...nReportJob.cs => NewSiteFileVersionExpirationReportJob.cs} | 4 ++-- ...tchDeleteJob.cs => RemoveSiteFileVersionBatchDeleteJob.cs} | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) rename src/Commands/Lists/{GetLibraryLevelFileVersionExpirationReportJobProgress.cs => GetLibraryFileVersionExpirationReportJobProgress.cs} (87%) rename src/Commands/Lists/{NewLibraryLevelFileVersionBatchDeleteJob.cs => NewLibraryFileVersionBatchDeleteJob.cs} (90%) rename src/Commands/Lists/{NewLibraryLevelFileVersionExpirationReportJob.cs => NewLibraryFileVersionExpirationReportJob.cs} (85%) rename src/Commands/Lists/{RemoveLibraryLevelFileVersionBatchDeleteJob.cs => RemoveLibraryFileVersionBatchDeleteJob.cs} (89%) rename src/Commands/Site/{GetSiteLevelFileVersionExpirationReportJobProgress.cs => GetSiteFileVersionExpirationReportJobProgress.cs} (84%) rename src/Commands/Site/{NewSiteLevelFileVersionBatchDeleteJob.cs => NewSiteFileVersionBatchDeleteJob.cs} (88%) rename src/Commands/Site/{NewSiteLevelFileVersionExpirationReportJob.cs => NewSiteFileVersionExpirationReportJob.cs} (81%) rename src/Commands/Site/{RemoveSiteLevelFileVersionBatchDeleteJob.cs => RemoveSiteFileVersionBatchDeleteJob.cs} (86%) diff --git a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Lists/GetLibraryFileVersionExpirationReportJobProgress.cs similarity index 87% rename from src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs rename to src/Commands/Lists/GetLibraryFileVersionExpirationReportJobProgress.cs index 81c46f6dc..9b8a9381c 100644 --- a/src/Commands/Lists/GetLibraryLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Lists/GetLibraryFileVersionExpirationReportJobProgress.cs @@ -9,9 +9,9 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.Get, "LibraryLevelFileVersionExpirationReportJobProgress")] + [Cmdlet(VerbsCommon.Get, "PnPLibraryFileVersionExpirationReportJobProgress")] [OutputType(typeof(FileVersionExpirationReportJobProgress))] - public class GetLibraryLevelFileVersionExpirationReportJobProgress : PnPWebCmdlet + public class GetLibraryFileVersionExpirationReportJobProgress : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] diff --git a/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs similarity index 90% rename from src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs index 1a6c22b21..afbfa576a 100644 --- a/src/Commands/Lists/NewLibraryLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.New, "LibraryLevelFileVersionBatchDeleteJob")] - public class NewLibraryLevelFileVersionBatchDeleteJob : PnPWebCmdlet + [Cmdlet(VerbsCommon.New, "PnPLibraryFileVersionBatchDeleteJob")] + public class NewLibraryFileVersionBatchDeleteJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] diff --git a/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs b/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs similarity index 85% rename from src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs rename to src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs index 64c4f3daa..5151046b2 100644 --- a/src/Commands/Lists/NewLibraryLevelFileVersionExpirationReportJob.cs +++ b/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs @@ -7,8 +7,8 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.New, "LibraryLevelFileVersionExpirationReportJob")] - public class NewLibraryLevelFileVersionExpirationReportJob : PnPWebCmdlet + [Cmdlet(VerbsCommon.New, "PnPLibraryFileVersionExpirationReportJob")] + public class NewLibraryFileVersionExpirationReportJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] diff --git a/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs b/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs similarity index 89% rename from src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs index 4f57cbe54..cc17153ad 100644 --- a/src/Commands/Lists/RemoveLibraryLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Lists { - [Cmdlet(VerbsCommon.Remove, "LibraryLevelFileVersionBatchDeleteJob")] - public class RemoveLibraryLevelFileVersionBatchDeleteJob : PnPWebCmdlet + [Cmdlet(VerbsCommon.Remove, "PnPLibraryFileVersionBatchDeleteJob")] + public class RemoveLibraryFileVersionBatchDeleteJob : PnPWebCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] [ValidateNotNull] diff --git a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs b/src/Commands/Site/GetSiteFileVersionExpirationReportJobProgress.cs similarity index 84% rename from src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs rename to src/Commands/Site/GetSiteFileVersionExpirationReportJobProgress.cs index 386c089e9..8d9b490b9 100644 --- a/src/Commands/Site/GetSiteLevelFileVersionExpirationReportJobProgress.cs +++ b/src/Commands/Site/GetSiteFileVersionExpirationReportJobProgress.cs @@ -9,9 +9,9 @@ namespace PnP.PowerShell.Commands.Sites { - [Cmdlet(VerbsCommon.Get, "SiteLevelFileVersionExpirationReportJobProgress")] + [Cmdlet(VerbsCommon.Get, "PnPSiteFileVersionExpirationReportJobProgress")] [OutputType(typeof(FileVersionExpirationReportJobProgress))] - public class GetSiteLevelFileVersionExpirationReportJobProgress : PnPSharePointCmdlet + public class GetSiteFileVersionExpirationReportJobProgress : PnPSharePointCmdlet { [Parameter(Mandatory = true)] public string ReportUrl; diff --git a/src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs b/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs similarity index 88% rename from src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs index 6381f8860..1cd3302ab 100644 --- a/src/Commands/Site/NewSiteLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Sites { - [Cmdlet(VerbsCommon.New, "SiteLevelFileVersionBatchDeleteJob")] - public class NewSiteLevelFileVersionBatchDeleteJob : PnPSharePointCmdlet + [Cmdlet(VerbsCommon.New, "PnPSiteFileVersionBatchDeleteJob")] + public class NewSiteFileVersionBatchDeleteJob : PnPSharePointCmdlet { [Parameter(Mandatory = true)] public int DeleteBeforeDays; diff --git a/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs b/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs similarity index 81% rename from src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs rename to src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs index a3fca6ae2..b6ec3420c 100644 --- a/src/Commands/Site/NewSiteLevelFileVersionExpirationReportJob.cs +++ b/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs @@ -7,8 +7,8 @@ namespace PnP.PowerShell.Commands.Sites { - [Cmdlet(VerbsCommon.New, "SiteLevelFileVersionExpirationReportJob")] - public class NewSiteLevelFileVersionExpirationReportJob : PnPSharePointCmdlet + [Cmdlet(VerbsCommon.New, "PnPSiteFileVersionExpirationReportJob")] + public class NewSiteFileVersionExpirationReportJob : PnPSharePointCmdlet { [Parameter(Mandatory = true)] public string ReportUrl; diff --git a/src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs b/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs similarity index 86% rename from src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs rename to src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs index 54bc2376d..f511aec1e 100644 --- a/src/Commands/Site/RemoveSiteLevelFileVersionBatchDeleteJob.cs +++ b/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs @@ -9,8 +9,8 @@ namespace PnP.PowerShell.Commands.Sites { - [Cmdlet(VerbsCommon.Remove, "SiteLevelFileVersionBatchDeleteJob")] - public class RemoveSiteLevelFileVersionBatchDeleteJob : PnPSharePointCmdlet + [Cmdlet(VerbsCommon.Remove, "PnPSiteFileVersionBatchDeleteJob")] + public class RemoveSiteFileVersionBatchDeleteJob : PnPSharePointCmdlet { [Parameter(Mandatory = false)] public SwitchParameter Force; From d75aa7900f1e8069d7fd8229dd052f304bdb6d91 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 15:08:36 -0800 Subject: [PATCH 10/21] No more verbose messages. --- src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs | 4 ++-- .../Lists/NewLibraryFileVersionExpirationReportJob.cs | 2 +- src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs | 4 ++-- src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs | 4 ++-- src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs | 2 +- src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs b/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs index afbfa576a..98ffeb941 100644 --- a/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/NewLibraryFileVersionBatchDeleteJob.cs @@ -32,12 +32,12 @@ protected override void ExecuteCmdlet() list.StartDeleteFileVersions(DeleteBeforeDays); ClientContext.ExecuteQueryRetry(); - WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); + WriteObject("Success. Versions specified will be permanently deleted in the upcoming days."); } } else { - WriteVerbose("Cancelled. No versions will be deleted."); + WriteObject("Cancelled. No versions will be deleted."); } } } diff --git a/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs b/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs index 5151046b2..43ed6317f 100644 --- a/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs +++ b/src/Commands/Lists/NewLibraryFileVersionExpirationReportJob.cs @@ -25,7 +25,7 @@ protected override void ExecuteCmdlet() list.StartFileVersionExpirationReport(ReportUrl); ClientContext.ExecuteQueryRetry(); - WriteVerbose("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small library, and a few days for a larger one."); + WriteObject("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small library, and a few days for a larger one."); } } } diff --git a/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs b/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs index cc17153ad..c25effb2f 100644 --- a/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs +++ b/src/Commands/Lists/RemoveLibraryFileVersionBatchDeleteJob.cs @@ -30,11 +30,11 @@ protected override void ExecuteCmdlet() ClientContext.ExecuteQueryRetry(); } - WriteVerbose("Future deletion is successfully stopped."); + WriteObject("Future deletion is successfully stopped."); } else { - WriteVerbose("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); + WriteObject("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); } } } diff --git a/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs b/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs index 1cd3302ab..6da8d9c06 100644 --- a/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs +++ b/src/Commands/Site/NewSiteFileVersionBatchDeleteJob.cs @@ -26,11 +26,11 @@ protected override void ExecuteCmdlet() site.StartDeleteFileVersions(DeleteBeforeDays); ClientContext.ExecuteQueryRetry(); - WriteVerbose("Success. Versions specified will be permanently deleted in the upcoming days."); + WriteObject("Success. Versions specified will be permanently deleted in the upcoming days."); } else { - WriteVerbose("Cancelled. No versions will be deleted."); + WriteObject("Cancelled. No versions will be deleted."); } } } diff --git a/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs b/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs index b6ec3420c..05faef2a2 100644 --- a/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs +++ b/src/Commands/Site/NewSiteFileVersionExpirationReportJob.cs @@ -19,7 +19,7 @@ protected override void ExecuteCmdlet() site.StartFileVersionExpirationReport(ReportUrl); ClientContext.ExecuteQueryRetry(); - WriteVerbose("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small site, and a few days for a larger one."); + WriteObject("Success. The file version expiration report will be gradually populated. It will take over 24 hours to complete for a small site, and a few days for a larger one."); } } } diff --git a/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs b/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs index f511aec1e..1a3685977 100644 --- a/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs +++ b/src/Commands/Site/RemoveSiteFileVersionBatchDeleteJob.cs @@ -23,11 +23,11 @@ protected override void ExecuteCmdlet() site.CancelDeleteFileVersions(); ClientContext.ExecuteQueryRetry(); - WriteVerbose("Future deletion is successfully stopped."); + WriteObject("Future deletion is successfully stopped."); } else { - WriteVerbose("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); + WriteObject("Did not receive confirmation to stop deletion. Continuing to delete specified versions."); } } } From ff0bc05350f766a32c244736c19dc10a67cc03de Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 29 Feb 2024 15:48:47 -0800 Subject: [PATCH 11/21] Add doc for Get-PnPFileVersion. --- documentation/Get-PnPFileVersion.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/documentation/Get-PnPFileVersion.md b/documentation/Get-PnPFileVersion.md index 952f30043..25590cbf5 100644 --- a/documentation/Get-PnPFileVersion.md +++ b/documentation/Get-PnPFileVersion.md @@ -15,12 +15,14 @@ Retrieves the previous versions of a file. Does not retrieve the current version ## SYNTAX ```powershell -Get-PnPFileVersion -Url [-Connection ] +Get-PnPFileVersion -Url [-UseVersionExpirationReport] [-Connection ] ``` ## DESCRIPTION Retrieves the version history of a file, not including its current version. To get the current version use the MajorVersion and MinorVersion properties returned from Get-PnPFile. +It can optionally return the version expiration report, which contains the versions' SnapshotDate (or estimated SnapshotDate if it is not available) and estimated ExpirationDate based on the Automatic Version History Limits. + ## EXAMPLES ### EXAMPLE 1 @@ -37,6 +39,13 @@ Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx" Retrieves the file version information for the specified file by specifying the path to the site and the document library's URL. +### EXAMPLE 3 +```powershell +Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx" -UseVersionExpirationReport +``` + +Retrieves the version expiration report for the specified file. + ## PARAMETERS ### -Connection @@ -66,6 +75,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -UseVersionExpirationReport +Returns the file version expiration report. The versions contained in the report has the SnapshotDate (or estimated SnapshotDate if it is not available) and estimated ExpirationDate based on the Automatic Version History Limits. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ## RELATED LINKS From 76184da1d92cae1318d9f961558b403ae556a8ab Mon Sep 17 00:00:00 2001 From: blarrywang Date: Fri, 1 Mar 2024 11:37:20 -0800 Subject: [PATCH 12/21] Add docs for new cmdlets. --- ...yFileVersionExpirationReportJobProgress.md | 74 +++++++++++++++ ...eFileVersionExpirationReportJobProgress.md | 60 ++++++++++++ ...New-PnPLibraryFileVersionBatchDeleteJob.md | 94 +++++++++++++++++++ ...nPLibraryFileVersionExpirationReportJob.md | 74 +++++++++++++++ .../New-PnPSiteFileVersionBatchDeleteJob.md | 80 ++++++++++++++++ ...w-PnPSiteFileVersionExpirationReportJob.md | 60 ++++++++++++ ...ove-PnPLibraryFileVersionBatchDeleteJob.md | 80 ++++++++++++++++ ...Remove-PnPSiteFileVersionBatchDeleteJob.md | 66 +++++++++++++ 8 files changed, 588 insertions(+) create mode 100644 documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md create mode 100644 documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md create mode 100644 documentation/New-PnPLibraryFileVersionBatchDeleteJob.md create mode 100644 documentation/New-PnPLibraryFileVersionExpirationReportJob.md create mode 100644 documentation/New-PnPSiteFileVersionBatchDeleteJob.md create mode 100644 documentation/New-PnPSiteFileVersionExpirationReportJob.md create mode 100644 documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md create mode 100644 documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md diff --git a/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md b/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md new file mode 100644 index 000000000..b169f862b --- /dev/null +++ b/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md @@ -0,0 +1,74 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPLibraryFileVersionExpirationReportJobProgress.html +external help file: PnP.PowerShell.dll-Help.xml +title: Get-PnPLibraryFileVersionExpirationReportJobProgress +--- + +# Get-PnPLibraryFileVersionExpirationReportJobProgress + +## SYNOPSIS + +Gets the status for a file version usage report generation job for a document library. + + +## SYNTAX + +```powershell +Get-PnPLibraryFileVersionExpirationReportJobProgress [-Identity] -ReportUrl +``` + + +## DESCRIPTION + +Gets the status for a file version usage report generation job for a document library. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv" +``` + +Gets the status for a file version usage report generation job for a document library. + + +## PARAMETERS + +### -Identity +The ID, name or Url (Lists/MyList) of the document library to get the job status on. + +```yaml +Type: ListPipeBind +Parameter Sets: (All) + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ReportUrl +The URL of the report to get the job status on. + +```yaml +Type: string +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md b/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md new file mode 100644 index 000000000..9103fa6a6 --- /dev/null +++ b/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md @@ -0,0 +1,60 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSiteFileVersionExpirationReportJobProgress.html +external help file: PnP.PowerShell.dll-Help.xml +title: Get-PnPSiteFileVersionExpirationReportJobProgress +--- + +# Get-PnPSiteFileVersionExpirationReportJobProgress + +## SYNOPSIS + +Gets the status for a file version usage report generation job for a site collection. + + +## SYNTAX + +```powershell +Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl +``` + + +## DESCRIPTION + +Gets the status for a file version usage report generation job for a site collection. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv" +``` + +Gets the status for a file version usage report generation job for a site collection. + + +## PARAMETERS + +### -ReportUrl +The URL of the report to get the job status on. + +```yaml +Type: string +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md b/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md new file mode 100644 index 000000000..42182920e --- /dev/null +++ b/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md @@ -0,0 +1,94 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionBatchDeleteJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: New-PnPLibraryFileVersionBatchDeleteJob +--- + +# New-PnPLibraryFileVersionBatchDeleteJob + +## SYNOPSIS + +Starts a file version batch trim job for a document library. + + +## SYNTAX + +```powershell +New-PnPLibraryFileVersionBatchDeleteJob [-Identity] -DeleteBeforeDays [-Force] +``` + + +## DESCRIPTION + +Starts a file version batch trim job for a document library. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 +``` + +Starts a file version batch trim job that will delete all file verions that are over 360 days old in the document library. + +### EXAMPLE 2 +```powershell +New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 -Force +``` + +Starts a file version batch trim job that will delete all file verions that are over 360 days old in the document library, without prompting the user for confirmation. + + +## PARAMETERS + +### -Identity +The ID, name or Url (Lists/MyList) of the document library to perform the trimming on. + +```yaml +Type: ListPipeBind +Parameter Sets: (All) + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DeleteBeforeDays +The minimum age of file versions to trim. In other words, all file versions that are older than this number of days will be deleted. + +```yaml +Type: int +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +When provided, no confirmation prompts will be shown to the user. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/New-PnPLibraryFileVersionExpirationReportJob.md b/documentation/New-PnPLibraryFileVersionExpirationReportJob.md new file mode 100644 index 000000000..26b4348c9 --- /dev/null +++ b/documentation/New-PnPLibraryFileVersionExpirationReportJob.md @@ -0,0 +1,74 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionExpirationReportJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: New-PnPLibraryFileVersionExpirationReportJob +--- + +# New-PnPLibraryFileVersionExpirationReportJob + +## SYNOPSIS + +Starts generating file version usage report for a document library. + + +## SYNTAX + +```powershell +New-PnPLibraryFileVersionExpirationReportJob [-Identity] -ReportUrl +``` + + +## DESCRIPTION + +Starts generating file version usage report for a document library. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +New-PnPLibraryFileVersionExpirationReportJob -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv" +``` + +Starts generating file version usage report for a document library, saving the result to a csv file within the site collection. + + +## PARAMETERS + +### -Identity +The ID, name or Url (Lists/MyList) of the document library to gather a file version usage report on. + +```yaml +Type: ListPipeBind +Parameter Sets: (All) + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ReportUrl +The URL of the report to save to. + +```yaml +Type: string +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/New-PnPSiteFileVersionBatchDeleteJob.md b/documentation/New-PnPSiteFileVersionBatchDeleteJob.md new file mode 100644 index 000000000..60e5a3927 --- /dev/null +++ b/documentation/New-PnPSiteFileVersionBatchDeleteJob.md @@ -0,0 +1,80 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/New-PnPSiteFileVersionBatchDeleteJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: New-PnPSiteFileVersionBatchDeleteJob +--- + +# New-PnPSiteFileVersionBatchDeleteJob + +## SYNOPSIS + +Starts a file version batch trim job targeting all document libraries in a site collection. + + +## SYNTAX + +```powershell +New-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays [-Force] +``` + + +## DESCRIPTION + +Starts a file version batch trim job targeting all document libraries in a site collection. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +New-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays 360 +``` + +Starts a file version batch trim job that will delete all file verions that are over 360 days old in all document libraries in the site collection. + +### EXAMPLE 2 +```powershell +New-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays 360 -Force +``` + +Starts a file version batch trim job that will delete all file verions that are over 360 days old in all document libraries in the site collection, without prompting the user for confirmation. + + +## PARAMETERS + +### -DeleteBeforeDays +The minimum age of file versions to trim. In other words, all file versions that are older than this number of days will be deleted. + +```yaml +Type: int +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +When provided, no confirmation prompts will be shown to the user. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/New-PnPSiteFileVersionExpirationReportJob.md b/documentation/New-PnPSiteFileVersionExpirationReportJob.md new file mode 100644 index 000000000..cca109957 --- /dev/null +++ b/documentation/New-PnPSiteFileVersionExpirationReportJob.md @@ -0,0 +1,60 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/New-PnPSiteFileVersionExpirationReportJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: New-PnPSiteFileVersionExpirationReportJob +--- + +# New-PnPSiteFileVersionExpirationReportJob + +## SYNOPSIS + +Starts generating file version usage report for a site collection. + + +## SYNTAX + +```powershell +New-PnPSiteFileVersionExpirationReportJob -ReportUrl +``` + + +## DESCRIPTION + +Starts generating file version usage report for a site collection. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +New-PnPSiteFileVersionExpirationReportJob -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv" +``` + +Starts generating file version usage report on for the site collection, saving the result to a csv file within the site collection. + + +## PARAMETERS + +### -ReportUrl +The URL of the report to save to. + +```yaml +Type: string +Parameter Sets: (All) + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md b/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md new file mode 100644 index 000000000..30ba94dcd --- /dev/null +++ b/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md @@ -0,0 +1,80 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPLibraryFileVersionBatchDeleteJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: Remove-PnPLibraryFileVersionBatchDeleteJob +--- + +# Remove-PnPLibraryFileVersionBatchDeleteJob + +## SYNOPSIS + +Cancels further processing of a file version batch trim job for a document library. + + +## SYNTAX + +```powershell +Remove-PnPLibraryFileVersionBatchDeleteJob [-Identity] -DeleteBeforeDays [-Force] +``` + + +## DESCRIPTION + +Cancels further processing of a file version batch trim job for a document library. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Remove-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" +``` + +Cancels further processing of the file version batch trim job for the document library. + +### EXAMPLE 2 +```powershell +Remove-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 -Force +``` + +Cancels further processing of the file version batch trim job for the document library, without prompting the user for confirmation. + + +## PARAMETERS + +### -Identity +The ID, name or Url (Lists/MyList) of the document library to stop further trimming on. + +```yaml +Type: ListPipeBind +Parameter Sets: (All) + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Force +When provided, no confirmation prompts will be shown to the user. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + diff --git a/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md b/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md new file mode 100644 index 000000000..fc9ae4802 --- /dev/null +++ b/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md @@ -0,0 +1,66 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPSiteFileVersionBatchDeleteJob.html +external help file: PnP.PowerShell.dll-Help.xml +title: Remove-PnPSiteFileVersionBatchDeleteJob +--- + +# Remove-PnPSiteFileVersionBatchDeleteJob + +## SYNOPSIS + +Cancels further processing of a file version batch trim job for a site collection. + + +## SYNTAX + +```powershell +Remove-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays [-Force] +``` + + +## DESCRIPTION + +Cancels further processing of a file version batch trim job for a site collection. + + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Remove-PnPSiteFileVersionBatchDeleteJob +``` + +Cancels further processing of the file version batch trim job for the site collection. + +### EXAMPLE 2 +```powershell +Remove-PnPSiteFileVersionBatchDeleteJob -Force +``` + +Cancels further processing of the file version batch trim job for the site collection, without prompting the user for confirmation. + + +## PARAMETERS + +### -Force +When provided, no confirmation prompts will be shown to the user. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) + + From 1dc6a7ca8944bb23f9a21ddef7c1f11981ad71f6 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:21:39 +0100 Subject: [PATCH 13/21] Fixing syntax --- ...t-PnPLibraryFileVersionExpirationReportJobProgress.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md b/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md index b169f862b..5889d312c 100644 --- a/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md +++ b/documentation/Get-PnPLibraryFileVersionExpirationReportJobProgress.md @@ -13,19 +13,16 @@ title: Get-PnPLibraryFileVersionExpirationReportJobProgress Gets the status for a file version usage report generation job for a document library. - ## SYNTAX ```powershell -Get-PnPLibraryFileVersionExpirationReportJobProgress [-Identity] -ReportUrl +Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity -ReportUrl ``` - ## DESCRIPTION Gets the status for a file version usage report generation job for a document library. - ## EXAMPLES ### EXAMPLE 1 @@ -35,7 +32,6 @@ Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity "Documents" -Repo Gets the status for a file version usage report generation job for a document library. - ## PARAMETERS ### -Identity @@ -66,9 +62,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From f1d71ac0be9dd2bb6112f4243fc08601a3d76761 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:22:34 +0100 Subject: [PATCH 14/21] Changed blah sample to marketing --- documentation/Get-PnPFileVersion.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/documentation/Get-PnPFileVersion.md b/documentation/Get-PnPFileVersion.md index 25590cbf5..367839144 100644 --- a/documentation/Get-PnPFileVersion.md +++ b/documentation/Get-PnPFileVersion.md @@ -34,14 +34,14 @@ Retrieves the file version information for the specified file. ### EXAMPLE 2 ```powershell -Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx" +Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx" ``` Retrieves the file version information for the specified file by specifying the path to the site and the document library's URL. ### EXAMPLE 3 ```powershell -Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx" -UseVersionExpirationReport +Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx" -UseVersionExpirationReport ``` Retrieves the version expiration report for the specified file. @@ -89,10 +89,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - - ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From c968b543a96f18828f8e85573551cf116cfc7631 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:23:27 +0100 Subject: [PATCH 15/21] Removed extra linebreaks --- .../Get-PnPSiteFileVersionExpirationReportJobProgress.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md b/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md index 9103fa6a6..fd7f78030 100644 --- a/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md +++ b/documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md @@ -13,19 +13,16 @@ title: Get-PnPSiteFileVersionExpirationReportJobProgress Gets the status for a file version usage report generation job for a site collection. - ## SYNTAX ```powershell Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl ``` - ## DESCRIPTION Gets the status for a file version usage report generation job for a site collection. - ## EXAMPLES ### EXAMPLE 1 @@ -35,7 +32,6 @@ Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl "https://contoso.sh Gets the status for a file version usage report generation job for a site collection. - ## PARAMETERS ### -ReportUrl @@ -52,9 +48,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From 083d52602b2a13f4abfa1a1ea856d8f9d3e0eda1 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:24:19 +0100 Subject: [PATCH 16/21] Syntax fix and removing extra linebreaks --- documentation/New-PnPLibraryFileVersionBatchDeleteJob.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md b/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md index 42182920e..71bf27f0a 100644 --- a/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md +++ b/documentation/New-PnPLibraryFileVersionBatchDeleteJob.md @@ -13,19 +13,16 @@ title: New-PnPLibraryFileVersionBatchDeleteJob Starts a file version batch trim job for a document library. - ## SYNTAX ```powershell -New-PnPLibraryFileVersionBatchDeleteJob [-Identity] -DeleteBeforeDays [-Force] +New-PnPLibraryFileVersionBatchDeleteJob -Identity -DeleteBeforeDays [-Force] ``` - ## DESCRIPTION Starts a file version batch trim job for a document library. - ## EXAMPLES ### EXAMPLE 1 @@ -42,7 +39,6 @@ New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays Starts a file version batch trim job that will delete all file verions that are over 360 days old in the document library, without prompting the user for confirmation. - ## PARAMETERS ### -Identity @@ -90,5 +86,3 @@ Accept wildcard characters: False ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From 47c00e23a41b68542e61e60d300119000cdd433d Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:25:06 +0100 Subject: [PATCH 17/21] Syntax fix and removing extra linebreaks --- .../New-PnPLibraryFileVersionExpirationReportJob.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/documentation/New-PnPLibraryFileVersionExpirationReportJob.md b/documentation/New-PnPLibraryFileVersionExpirationReportJob.md index 26b4348c9..8ac8740c4 100644 --- a/documentation/New-PnPLibraryFileVersionExpirationReportJob.md +++ b/documentation/New-PnPLibraryFileVersionExpirationReportJob.md @@ -13,19 +13,16 @@ title: New-PnPLibraryFileVersionExpirationReportJob Starts generating file version usage report for a document library. - ## SYNTAX ```powershell -New-PnPLibraryFileVersionExpirationReportJob [-Identity] -ReportUrl +New-PnPLibraryFileVersionExpirationReportJob -Identity -ReportUrl ``` - ## DESCRIPTION Starts generating file version usage report for a document library. - ## EXAMPLES ### EXAMPLE 1 @@ -35,7 +32,6 @@ New-PnPLibraryFileVersionExpirationReportJob -Identity "Documents" -ReportUrl "h Starts generating file version usage report for a document library, saving the result to a csv file within the site collection. - ## PARAMETERS ### -Identity @@ -66,9 +62,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From a7dbf6ed3a5b3145edcb68898242ac1d567f232b Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:25:38 +0100 Subject: [PATCH 18/21] Extra linebreaks removed --- documentation/New-PnPSiteFileVersionBatchDeleteJob.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/documentation/New-PnPSiteFileVersionBatchDeleteJob.md b/documentation/New-PnPSiteFileVersionBatchDeleteJob.md index 60e5a3927..826d1c606 100644 --- a/documentation/New-PnPSiteFileVersionBatchDeleteJob.md +++ b/documentation/New-PnPSiteFileVersionBatchDeleteJob.md @@ -13,19 +13,16 @@ title: New-PnPSiteFileVersionBatchDeleteJob Starts a file version batch trim job targeting all document libraries in a site collection. - ## SYNTAX ```powershell New-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays [-Force] ``` - ## DESCRIPTION Starts a file version batch trim job targeting all document libraries in a site collection. - ## EXAMPLES ### EXAMPLE 1 @@ -42,7 +39,6 @@ New-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays 360 -Force Starts a file version batch trim job that will delete all file verions that are over 360 days old in all document libraries in the site collection, without prompting the user for confirmation. - ## PARAMETERS ### -DeleteBeforeDays @@ -76,5 +72,3 @@ Accept wildcard characters: False ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From 23e20dbd7d45a0d9440e8f87d177bc792f4e3218 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:26:13 +0100 Subject: [PATCH 19/21] Extra linebreaks removed --- documentation/New-PnPSiteFileVersionExpirationReportJob.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/documentation/New-PnPSiteFileVersionExpirationReportJob.md b/documentation/New-PnPSiteFileVersionExpirationReportJob.md index cca109957..d7fedba82 100644 --- a/documentation/New-PnPSiteFileVersionExpirationReportJob.md +++ b/documentation/New-PnPSiteFileVersionExpirationReportJob.md @@ -13,19 +13,16 @@ title: New-PnPSiteFileVersionExpirationReportJob Starts generating file version usage report for a site collection. - ## SYNTAX ```powershell New-PnPSiteFileVersionExpirationReportJob -ReportUrl ``` - ## DESCRIPTION Starts generating file version usage report for a site collection. - ## EXAMPLES ### EXAMPLE 1 @@ -35,7 +32,6 @@ New-PnPSiteFileVersionExpirationReportJob -ReportUrl "https://contoso.sharepoint Starts generating file version usage report on for the site collection, saving the result to a csv file within the site collection. - ## PARAMETERS ### -ReportUrl @@ -52,9 +48,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From adc59b45985728e181dd7ce31c49712dfebd3c1f Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:28:03 +0100 Subject: [PATCH 20/21] Syntax fix, removing incorrect parameter and linebreaks --- .../Remove-PnPLibraryFileVersionBatchDeleteJob.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md b/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md index 30ba94dcd..137c2cf0e 100644 --- a/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md +++ b/documentation/Remove-PnPLibraryFileVersionBatchDeleteJob.md @@ -13,19 +13,16 @@ title: Remove-PnPLibraryFileVersionBatchDeleteJob Cancels further processing of a file version batch trim job for a document library. - ## SYNTAX ```powershell -Remove-PnPLibraryFileVersionBatchDeleteJob [-Identity] -DeleteBeforeDays [-Force] +Remove-PnPLibraryFileVersionBatchDeleteJob -Identity [-Force] ``` - ## DESCRIPTION Cancels further processing of a file version batch trim job for a document library. - ## EXAMPLES ### EXAMPLE 1 @@ -42,7 +39,6 @@ Remove-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDa Cancels further processing of the file version batch trim job for the document library, without prompting the user for confirmation. - ## PARAMETERS ### -Identity @@ -76,5 +72,3 @@ Accept wildcard characters: False ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - - From a967c4ab83a4ade227e3f8a2c777aeca37d3c170 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 2 Mar 2024 00:29:12 +0100 Subject: [PATCH 21/21] Removing incorrect parameter --- documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md b/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md index fc9ae4802..8520bae9a 100644 --- a/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md +++ b/documentation/Remove-PnPSiteFileVersionBatchDeleteJob.md @@ -13,19 +13,16 @@ title: Remove-PnPSiteFileVersionBatchDeleteJob Cancels further processing of a file version batch trim job for a site collection. - ## SYNTAX ```powershell -Remove-PnPSiteFileVersionBatchDeleteJob -DeleteBeforeDays [-Force] +Remove-PnPSiteFileVersionBatchDeleteJob [-Force] ``` - ## DESCRIPTION Cancels further processing of a file version batch trim job for a site collection. - ## EXAMPLES ### EXAMPLE 1 @@ -42,7 +39,6 @@ Remove-PnPSiteFileVersionBatchDeleteJob -Force Cancels further processing of the file version batch trim job for the site collection, without prompting the user for confirmation. - ## PARAMETERS ### -Force @@ -62,5 +58,3 @@ Accept wildcard characters: False ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - -