Added max list size circumvention for file transfers between sites.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user