Skip to content

Commit 193a5aa

Browse files
committed
Rewrote Verbose and Warning messages to go through the new logging framework
1 parent fa8d316 commit 193a5aa

File tree

197 files changed

+627
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+627
-623
lines changed

src/Commands/Admin/AddTenantRestrictedSearchAllowedList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected override void ExecuteCmdlet()
4646

4747
if(_sitelist.Count > 100)
4848
{
49-
WriteWarning($"The maximum number of sites that can be added to the allowed list is 100. You have specified {_sitelist.Count} sites. Will try to add them anyway.");
49+
LogWarning($"The maximum number of sites that can be added to the allowed list is 100. You have specified {_sitelist.Count} sites. Will try to add them anyway.");
5050
}
5151

5252
Tenant.AddSPORestrictedSearchAllowedList(_sitelist);

src/Commands/Admin/GetSiteCollectionAppCatalog.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class GetSiteCollectionAppCatalog : PnPSharePointOnlineAdminCmdlet
2323

2424
protected override void ExecuteCmdlet()
2525
{
26-
WriteVerbose("Retrieving all site collection App Catalogs from SharePoint Online");
26+
LogDebug("Retrieving all site collection App Catalogs from SharePoint Online");
2727

2828
var appCatalogsCsom = AdminContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites;
2929
AdminContext.Load(appCatalogsCsom);
@@ -38,20 +38,20 @@ protected override void ExecuteCmdlet()
3838
}
3939
).ToList();
4040

41-
WriteVerbose($"{appCatalogsLocalModel.Count} site collection App Catalog{(appCatalogsLocalModel.Count != 1 ? "s have" : " has")} been retrieved");
41+
LogDebug($"{appCatalogsLocalModel.Count} site collection App Catalog{(appCatalogsLocalModel.Count != 1 ? "s have" : " has")} been retrieved");
4242

4343
if (CurrentSite.ToBool())
4444
{
4545
ClientContext.Site.EnsureProperties(s => s.Id);
4646

47-
WriteVerbose($"Filtering down to only the current site at {Connection.Url} with ID {ClientContext.Site.Id}");
47+
LogDebug($"Filtering down to only the current site at {Connection.Url} with ID {ClientContext.Site.Id}");
4848
var currentSite = appCatalogsLocalModel.FirstOrDefault(a => a.SiteID.HasValue && a.SiteID.Value == ClientContext.Site.Id);
4949

5050
appCatalogsLocalModel.Clear();
5151

5252
if (currentSite == null)
5353
{
54-
WriteVerbose($"Current site at {Connection.Url} with ID {ClientContext.Site.Id} does not have a site collection App Catalog on it");
54+
LogDebug($"Current site at {Connection.Url} with ID {ClientContext.Site.Id} does not have a site collection App Catalog on it");
5555
return;
5656
}
5757

@@ -60,7 +60,7 @@ protected override void ExecuteCmdlet()
6060

6161
if(SkipUrlValidation.ToBool())
6262
{
63-
WriteVerbose($"Skipping URL validation since the {nameof(SkipUrlValidation)} flag has been provided");
63+
LogDebug($"Skipping URL validation since the {nameof(SkipUrlValidation)} flag has been provided");
6464
WriteObject(appCatalogsLocalModel, true);
6565
return;
6666
}
@@ -72,7 +72,7 @@ protected override void ExecuteCmdlet()
7272
{
7373
try
7474
{
75-
WriteVerbose($"Validating site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl}");
75+
LogDebug($"Validating site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl}");
7676

7777
// Deleted sites throw either an exception or return null
7878
appCatalogLocalModel.AbsoluteUrl = Tenant.GetSitePropertiesById(appCatalogLocalModel.SiteID.Value, false, Connection.TenantAdminUrl).Url;
@@ -84,12 +84,12 @@ protected override void ExecuteCmdlet()
8484
{
8585
if (!ExcludeDeletedSites.ToBool())
8686
{
87-
WriteVerbose($"Site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl} regards a site that has been deleted");
87+
LogDebug($"Site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl} regards a site that has been deleted");
8888
results.Add(appCatalogLocalModel);
8989
}
9090
else
9191
{
92-
WriteVerbose($"Site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl} regards a site that has been deleted. Since the {nameof(ExcludeDeletedSites)} flag has been provided, it will not be included in the results.");
92+
LogDebug($"Site collection App Catalog at {appCatalogLocalModel.AbsoluteUrl} regards a site that has been deleted. Since the {nameof(ExcludeDeletedSites)} flag has been provided, it will not be included in the results.");
9393
}
9494

9595
continue;

src/Commands/Admin/GetStorageEntity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected override void ExecuteCmdlet()
4848
}
4949
else
5050
{
51-
WriteWarning("Site Collection App Catalog is not available on this site.");
51+
LogWarning("Site Collection App Catalog is not available on this site.");
5252
}
5353
}
5454
else
@@ -82,7 +82,7 @@ protected override void ExecuteCmdlet()
8282
}
8383
else
8484
{
85-
WriteWarning("Tenant app catalog is not available on this tenant.");
85+
LogWarning("Tenant app catalog is not available on this tenant.");
8686
}
8787
}
8888

src/Commands/Admin/GetTenantDeletedSite.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected override void ExecuteCmdlet()
6363
}
6464
if (!flag2 && flag3)
6565
{
66-
WriteWarning("More sites are available");
66+
LogWarning("More sites are available");
6767
}
6868
}
6969
else
@@ -78,7 +78,7 @@ protected override void ExecuteCmdlet()
7878
}
7979
catch (ServerException e) when (e.ServerErrorTypeName.Equals("Microsoft.SharePoint.Client.UnknownError", StringComparison.InvariantCultureIgnoreCase))
8080
{
81-
WriteVerbose($"No sitecollection found in the tenant recycle bin with the Url {Identity.Url}");
81+
LogDebug($"No sitecollection found in the tenant recycle bin with the Url {Identity.Url}");
8282
}
8383
}
8484
}

src/Commands/Admin/GetTenantInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ protected override void ExecuteCmdlet()
3131
throw new PSArgumentException("Specify either DomainName or TenantId, but not both.");
3232
}
3333

34-
WriteVerbose("Acquiring access token for Microsoft Graph to look up Tenant");
34+
LogDebug("Acquiring access token for Microsoft Graph to look up Tenant");
3535
//var graphAccessToken = TokenHandler.GetAccessToken(this, $"https://{Connection.GraphEndPoint}/.default", Connection);
3636
var requestUrl = BuildRequestUrl();
3737

38-
WriteVerbose($"Making call to {requestUrl} to request tenant information");
38+
LogDebug($"Making call to {requestUrl} to request tenant information");
3939
var results = this.RequestHelper.Get<Model.TenantInfo>(requestUrl);
4040
WriteObject(results, true);
4141
}

src/Commands/Admin/InvokeSiteSwap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected override void ExecuteCmdlet()
3030
{
3131
var includeSmartGestures = !DisableRedirection;
3232

33-
WriteVerbose($"Invoking site swap with source {SourceUrl}, target {TargetUrl} and archive {ArchiveUrl}");
33+
LogDebug($"Invoking site swap with source {SourceUrl}, target {TargetUrl} and archive {ArchiveUrl}");
3434

3535
var operation = this.Tenant.SwapSiteWithSmartGestureOption(SourceUrl, TargetUrl, ArchiveUrl, includeSmartGestures);
3636
AdminContext.Load(operation);

src/Commands/Admin/NewContainerType.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ protected override void ExecuteCmdlet()
4444
SPContainerTypeProperties sPContainerTypeProperties;
4545
if (!ParameterSpecified(nameof(TrialContainerType)) || !TrialContainerType.ToBool())
4646
{
47-
WriteWarning($"Creation of standard container types is not yet supported. This will be enabled in the future. For now, only trial container types can be created by adding the -{nameof(TrialContainerType)} parameter.");
47+
LogWarning($"Creation of standard container types is not yet supported. This will be enabled in the future. For now, only trial container types can be created by adding the -{nameof(TrialContainerType)} parameter.");
4848
return;
4949

5050
// NOTICE:
5151
// Currently disabled by request of the product group as it doesn't work reliably yet
5252
// Once the official endpoint to create standard container types is available, this code can be enabled again and will point to the proper API to use
5353

54-
// WriteVerbose("Creating a standard container type");
54+
// LogDebug("Creating a standard container type");
5555

5656
// sPContainerTypeProperties = new SPContainerTypeProperties
5757
// {
@@ -65,7 +65,7 @@ protected override void ExecuteCmdlet()
6565
}
6666
else
6767
{
68-
WriteVerbose("Creating a trial container type");
68+
LogDebug("Creating a trial container type");
6969

7070
sPContainerTypeProperties = new SPContainerTypeProperties
7171
{
@@ -93,7 +93,7 @@ protected override void ExecuteCmdlet()
9393
}
9494
else
9595
{
96-
WriteVerbose("Failed to create container type");
96+
LogDebug("Failed to create container type");
9797
}
9898
}
9999
}

src/Commands/Admin/RegisterAppCatalogSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class RegisterAppCatalogSite : PnPSharePointOnlineAdminCmdlet
2222

2323
protected override void ExecuteCmdlet()
2424
{
25-
WriteWarning("Notice that this cmdlet can take considerate time to finish executing.");
25+
LogWarning("Notice that this cmdlet can take considerate time to finish executing.");
2626
Tenant.EnsureAppCatalogAsync(Url, Owner, TimeZoneId, Force).GetAwaiter().GetResult();
2727
}
2828
}

src/Commands/Admin/RemoveHomeSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected override void ExecuteCmdlet()
2424
}
2525
else
2626
{
27-
WriteWarning("There is currently not site collection set as a home site in your tenant.");
27+
LogWarning("There is currently not site collection set as a home site in your tenant.");
2828
}
2929
}
3030
}

src/Commands/Admin/RemoveStorageEntity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected override void ExecuteCmdlet()
2929
}
3030
else
3131
{
32-
WriteWarning("Tenant app catalog is not available on this tenant.");
32+
LogWarning("Tenant app catalog is not available on this tenant.");
3333
}
3434
}
3535
else
@@ -44,7 +44,7 @@ protected override void ExecuteCmdlet()
4444
}
4545
else
4646
{
47-
WriteWarning("Site Collection App Catalog is not available on this site.");
47+
LogWarning("Site Collection App Catalog is not available on this site.");
4848
}
4949
}
5050
}

src/Commands/Admin/RemoveTenantRestrictedSearchAllowedList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected override void ExecuteCmdlet()
4646

4747
if(_sitelist.Count > 100)
4848
{
49-
WriteWarning($"The maximum number of sites that can be added to the allowed list is 100. You have specified {_sitelist.Count} sites. Will try to add them anyway.");
49+
LogWarning($"The maximum number of sites that can be added to the allowed list is 100. You have specified {_sitelist.Count} sites. Will try to add them anyway.");
5050
}
5151

5252
Tenant.RemoveSPORestrictedSearchAllowedList(_sitelist);

src/Commands/Admin/RestoreDeletedContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ protected override void ExecuteCmdlet()
1818
{
1919
if (Force || ShouldContinue($"Restore container {Identity}?", Properties.Resources.Confirm))
2020
{
21-
WriteVerbose($"Restoring container {Identity}");
21+
LogDebug($"Restoring container {Identity}");
2222
Tenant.RestoreSPODeletedContainerByContainerId(Identity);
2323
AdminContext.ExecuteQueryRetry();
24-
WriteVerbose($"Restored container {Identity}");
24+
LogDebug($"Restored container {Identity}");
2525
}
2626
}
2727
}

src/Commands/Admin/RestoreTenantSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected override void ExecuteCmdlet()
3030
{
3131
if (Force || ShouldContinue($"Restore site collection {Identity.Url}?", Properties.Resources.Confirm))
3232
{
33-
WriteVerbose($"Restoring site collection {Identity.Url}");
33+
LogDebug($"Restoring site collection {Identity.Url}");
3434

3535
SpoOperation spoOperation = Tenant.RestoreDeletedSite(Identity.Url);
3636
AdminContext.Load(spoOperation);

src/Commands/Admin/RevokeUserSession.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@ protected override void ExecuteCmdlet()
2424
{
2525
case SPOUserSessionRevocationState.FeatureDisabled:
2626
{
27-
WriteWarning("This cmdlet will be available in the future, but is not ready for use in your organization yet.");
27+
LogWarning("This cmdlet will be available in the future, but is not ready for use in your organization yet.");
2828
break;
2929
}
3030
case SPOUserSessionRevocationState.Failure:
3131
{
32-
WriteWarning($"Sorry, something went wrong and we could not sign out {User} from any device.");
32+
LogWarning($"Sorry, something went wrong and we could not sign out {User} from any device.");
3333
break;
3434
}
3535
case SPOUserSessionRevocationState.InstantaneousSuccess:
3636
{
37-
WriteWarning($"We succesfully signed out {User} from all devices.");
37+
LogWarning($"We succesfully signed out {User} from all devices.");
3838
break;
3939
}
4040
case SPOUserSessionRevocationState.NonInstantaneousSuccess:
4141
{
42-
WriteWarning($"It can take up to an hour to sign out {User} from all devices.");
42+
LogWarning($"It can take up to an hour to sign out {User} from all devices.");
4343
break;
4444
}
4545
case SPOUserSessionRevocationState.UserNotFound:
4646
{
47-
WriteWarning($"We could not find the user {User}. Check for typos and try again.");
47+
LogWarning($"We could not find the user {User}. Check for typos and try again.");
4848
break;
4949
}
5050
default:

src/Commands/Admin/SetOrgAssetsLibrary.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@ protected override void ExecuteCmdlet()
2626
{
2727
if(ParameterSpecified(nameof(IsCopilotSearchable)) && ParameterSpecified(nameof(OrgAssetType)) && ParameterSpecified(nameof(ThumbnailUrl)))
2828
{
29-
WriteVerbose("Setting org assets library with thumbnail url, organizational asset type and copilot searchable");
29+
LogDebug("Setting org assets library with thumbnail url, organizational asset type and copilot searchable");
3030
Tenant.SetOrgAssetsWithConfig(LibraryUrl, ThumbnailUrl, OrgAssetType.Value, new OrgAssetsLibraryConfigParam { IsCopilotSearchable = IsCopilotSearchable.Value});
3131
}
3232
else if(ParameterSpecified(nameof(IsCopilotSearchable)) && ParameterSpecified(nameof(OrgAssetType)))
3333
{
34-
WriteVerbose("Setting org assets library with organizational asset type and copilot searchable");
34+
LogDebug("Setting org assets library with organizational asset type and copilot searchable");
3535
Tenant.SetOrgAssetsWithConfig(LibraryUrl, null, OrgAssetType.Value, new OrgAssetsLibraryConfigParam { IsCopilotSearchable = IsCopilotSearchable.Value});
3636
}
3737
else if(ParameterSpecified(nameof(OrgAssetType)) && ParameterSpecified(nameof(ThumbnailUrl)))
3838
{
39-
WriteVerbose("Setting org assets library with thumbnail url and organizational asset type");
39+
LogDebug("Setting org assets library with thumbnail url and organizational asset type");
4040
Tenant.SetOrgAssetsWithType(LibraryUrl, ThumbnailUrl, OrgAssetType.Value);
4141
}
4242
else if(ParameterSpecified(nameof(OrgAssetType)))
4343
{
44-
WriteVerbose("Setting org assets library with organizational asset type");
44+
LogDebug("Setting org assets library with organizational asset type");
4545
Tenant.SetOrgAssetsWithType(LibraryUrl, null, OrgAssetType.Value);
4646
}
4747
else if(ParameterSpecified(nameof(ThumbnailUrl)))
4848
{
49-
WriteVerbose("Setting org assets library with thumbnail url");
49+
LogDebug("Setting org assets library with thumbnail url");
5050
Tenant.SetOrgAssets(LibraryUrl, ThumbnailUrl);
5151
}
5252
AdminContext.ExecuteQueryRetry();

src/Commands/Admin/SetSiteArchiveState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected override void ExecuteCmdlet()
5151
{
5252
case "FullyArchived":
5353
{
54-
WriteWarning("Reactivating a site from \"Archived\" state is a paid operation. It can take upto 24hrs for the site to be reactivated. Performing the operation \"Reactivate Archived site\" on target.");
54+
LogWarning("Reactivating a site from \"Archived\" state is a paid operation. It can take upto 24hrs for the site to be reactivated. Performing the operation \"Reactivate Archived site\" on target.");
5555
if (Force || ShouldContinue(Identity.Url, Properties.Resources.Confirm))
5656
{
5757
spoOperation = Tenant.UnarchiveSiteByUrl(Identity.Url);

src/Commands/Admin/SetStorageEntity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected override void ExecuteCmdlet()
3939
}
4040
else
4141
{
42-
WriteWarning("Tenant app catalog is not available on this tenant.");
42+
LogWarning("Tenant app catalog is not available on this tenant.");
4343
}
4444
}
4545
else
@@ -54,7 +54,7 @@ protected override void ExecuteCmdlet()
5454
}
5555
else
5656
{
57-
WriteWarning("Site Collection App Catalog is not available on this site.");
57+
LogWarning("Site Collection App Catalog is not available on this site.");
5858
}
5959
}
6060
}

0 commit comments

Comments
 (0)