Added max list size circumvention for file transfers between sites.

This commit is contained in:
Dev
2026-05-13 15:58:16 +02:00
parent 4b51c8e3c3
commit 5d305ccc4c
27 changed files with 996 additions and 145 deletions
@@ -117,6 +117,7 @@ public class VersionCleanupService : IVersionCleanupService
IProgress<OperationProgress> progress,
CancellationToken ct)
{
int before = 0;
try
{
var file = ctx.Web.GetFileByServerRelativeUrl(fileServerRelativeUrl);
@@ -131,7 +132,7 @@ public class VersionCleanupService : IVersionCleanupService
// file.Versions contains only HISTORICAL versions; the current published
// version lives on `file` itself and is never deletable here.
var versions = file.Versions.ToList();
int before = versions.Count;
before = versions.Count;
if (before == 0) return null;
// Sort by Created ascending so [0] is the oldest historical version.
@@ -173,6 +174,7 @@ public class VersionCleanupService : IVersionCleanupService
BytesFreed = bytesFreed,
};
}
catch (OperationCanceledException) { throw; }
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to trim versions for {File}", fileServerRelativeUrl);
@@ -182,6 +184,7 @@ public class VersionCleanupService : IVersionCleanupService
Library = libraryTitle,
FileServerRelativeUrl = fileServerRelativeUrl,
FileName = System.IO.Path.GetFileName(fileServerRelativeUrl),
VersionsBefore = before,
Error = ex.Message,
};
}