Skip to content

Commit 0e460f8

Browse files
committed
add skip cache parameter
1 parent e3cbc38 commit 0e460f8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Modules/CIPPCore/Public/Get-CIPPSPOTenant.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ function Get-CIPPSPOTenant {
33
param(
44
[Parameter(Mandatory = $true)]
55
[string]$TenantFilter,
6-
[string]$SharepointPrefix
6+
[string]$SharepointPrefix,
7+
[switch]$SkipCache
78
)
89

910
if (!$SharepointPrefix) {
@@ -18,11 +19,12 @@ function Get-CIPPSPOTenant {
1819

1920
$Table = Get-CIPPTable -tablename 'cachespotenant'
2021
$Filter = "PartitionKey eq 'Tenant' and RowKey eq '$TenantFilter' and Timestamp gt datetime'$( (Get-Date).AddHours(-1).ToString('yyyy-MM-ddTHH:mm:ssZ') )'"
21-
$CachedTenant = Get-CIPPAzDataTableEntity @Table -Filter $Filter
22-
23-
if ($CachedTenant -and (Test-Json $CachedTenant.JSON)) {
24-
$Results = $CachedTenant.JSON | ConvertFrom-Json
25-
return $Results
22+
if (!$SkipCache.IsPresent) {
23+
$CachedTenant = Get-CIPPAzDataTableEntity @Table -Filter $Filter
24+
if ($CachedTenant -and (Test-Json $CachedTenant.JSON)) {
25+
$Results = $CachedTenant.JSON | ConvertFrom-Json
26+
return $Results
27+
}
2628
}
2729

2830
# Query tenant settings

0 commit comments

Comments
 (0)