Skip to content

Commit

Permalink
Adjust cancelation token
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbarur committed Mar 5, 2024
1 parent 97ea598 commit cf69b73
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/NovaPointLibrary/Solutions/Automation/CheckInFileAuto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private async Task ProcessItems(string siteUrl, List oList, ProgressTracker pare
var spoItem = new SPOListItemCSOM(_logger, _appInfo);
await foreach (ListItem oItem in spoItem.GetAsync(siteUrl, oList, _param.ItemsParam))
{
_appInfo.IsCancelled();

if (oItem.FileSystemObjectType.ToString() == "Folder") { continue; }

if (oItem.File.CheckOutType == CheckOutType.None) { continue; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private async Task ProcessItems(string siteUrl, List oList, ProgressTracker pare
var spoItem = new SPOListItemCSOM(_logger, _appInfo);
await foreach (ListItem oItem in spoItem.GetAsync(siteUrl, oList, _param.ItemsParam))
{
_appInfo.IsCancelled();

if (oItem.FileSystemObjectType.ToString() == "Folder") { continue; }

try
Expand Down Expand Up @@ -175,8 +177,6 @@ private async Task RemoveFileVersions(string siteUrl, List oList, ListItem oItem
fileVersionCollection.DeleteByID(fileVersionToDelete.ID);
}
clientContext.ExecuteQueryRetry();


}
}
catch (Exception ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ private async Task RunScriptAsync()
progress = new(_logger, collSiteCollections.Count);
foreach (var oSiteCollection in collSiteCollections)
{
_appInfo.IsCancelled();

await SetAdmin(oSiteCollection.Url);

progress.ProgressUpdateReport();
Expand Down
5 changes: 5 additions & 0 deletions src/NovaPointLibrary/Solutions/Report/PermissionsReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private async Task RunScriptAsync()
SPOSitePermissionsCSOM sitePermissions = new(_logger, _appInfo, _param.PermissionsParam);
await foreach (var siteResults in new SPOTenantSiteUrlsWithAccessCSOM(_logger, _appInfo, _param.SiteAccParam).GetAsyncNEW())
{
_appInfo.IsCancelled();

if (!String.IsNullOrWhiteSpace(siteResults.ErrorMessage))
{
Expand All @@ -84,6 +85,8 @@ private async Task RunScriptAsync()

await foreach (var oUser in new SPOSiteUserCSOM(_logger, _appInfo).GetAsync(siteResults.SiteUrl, _param.UserParam, _userRetrievalExpressions))
{
_appInfo.IsCancelled();

sb.Append($"{oUser.Title}: {oUser.UserPrincipalName} ");
}

Expand All @@ -99,6 +102,8 @@ private async Task RunScriptAsync()
{
await foreach(var record in sitePermissions.GetAsync(siteResults.SiteUrl, siteResults.Progress))
{
_appInfo.IsCancelled();

FilterRecord(record);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/NovaPointLibrary/Solutions/Report/SiteReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ private async Task RunScriptAsync()
{
await foreach (var admins in _sitePermissions.GetAsync(oSiteCollection.Url, progress))
{
_appInfo.IsCancelled();

recordSiteCollection.AddAdmins(admins);
_logger.RecordCSV(recordSiteCollection);
}
Expand Down Expand Up @@ -179,6 +181,8 @@ private async Task GetSubsitesAsync(string siteUrl, ProgressTracker parentProgre
ProgressTracker progress = new(parentProgress, collSubsites.Count);
foreach (var oSubsite in collSubsites)
{
_appInfo.IsCancelled();

SiteReportRecord siteRecord = new(oSubsite);

_logger.RecordCSV(siteRecord);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:NovaPointWPF.Pages.Solutions.Automation"
xmlns:designmaterial="clr-namespace:NovaPointWPF.UserControls"
mc:Ignorable="d"
d:DesignHeight="1200" d:DesignWidth="600"
d:DesignHeight="1000" d:DesignWidth="600"
Title="RemoveFileVersionAutoForm">

<Grid Background="Transparent">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@

<Label
Style="{DynamicResource SolutionFormLabel}"
Content="Library major versioning limit"/>
Content="Document Library major versioning limit"/>

<TextBox
Style="{DynamicResource SolutionFormTextBox}"
Text="{Binding LibraryMajorVersionLimit, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}"/>

<Label
Style="{DynamicResource SolutionFormLabel}"
Content="Library minor versioning limit"/>
Content="Document Library minor versioning limit"/>

<TextBox
Style="{DynamicResource SolutionFormTextBox}"
Text="{Binding LibraryMinorVersionLimit, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}"/>

<Label
Style="{DynamicResource SolutionFormLabel}"
Content="List major versioning limit"/>
Content="Item List major versioning limit"/>

<TextBox
Style="{DynamicResource SolutionFormTextBox}"
Expand Down

0 comments on commit cf69b73

Please sign in to comment.