Skip to content

Commit 1c4d8dc

Browse files
Resolves an issue with a parameter that is required for operation when a request is sent using an https api to the sharepoint rest api this commit resolves that issue and fixes the problem
1 parent b9e62a4 commit 1c4d8dc

File tree

9 files changed

+15
-17
lines changed

9 files changed

+15
-17
lines changed

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertSharepointQuota.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function Get-CIPPAlertSharepointQuota {
1111
$TenantFilter
1212
)
1313
Try {
14-
$SharePointInfo = Get-SharePointAdminLink -Public $false
14+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
1515
$sharepointQuota = (New-GraphGetRequest -scope "$($SharePointInfo.AdminUrl)/.default" -tenantid $TenantFilter -uri "$($SharePointInfo.AdminUrl)/_api/StorageQuotas()?api-version=1.3.2").value
1616
} catch {
1717
return

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointAdminUrl.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function Invoke-ListSharepointAdminUrl {
1919
if ($Tenant.SharepointAdminUrl) {
2020
$AdminUrl = $Tenant.SharepointAdminUrl
2121
} else {
22-
$SharePointInfo = Get-SharePointAdminLink -Public $false
22+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
2323
$Tenant | Add-Member -MemberType NoteProperty -Name SharepointAdminUrl -Value $SharePointInfo.AdminUrl
2424
$Table = Get-CIPPTable -TableName 'Tenants'
2525
Add-CIPPAzDataTableEntity @Table -Entity $Tenant -Force

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Teams-Sharepoint/Invoke-ListSharepointQuota.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Function Invoke-ListSharepointQuota {
2121
$UsedStoragePercentage = 'Not Supported'
2222
} else {
2323
try {
24-
$SharePointInfo = Get-SharePointAdminLink -Public $false
24+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
2525
$SharePointQuota = (New-GraphGetRequest -scope "$($SharePointInfo.AdminUrl)/.default" -tenantid $TenantFilter -uri "$($SharePointInfo.AdminUrl)/_api/StorageQuotas()?api-version=1.3.2").value | Sort-Object -Property GeoUsedStorageMB -Descending | Select-Object -First 1
2626

2727
if ($SharePointQuota) {

Modules/CIPPCore/Public/Get-CIPPSPOTenant.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Get-CIPPSPOTenant {
88

99
if (!$SharepointPrefix) {
1010
# get sharepoint admin site
11-
$SharePointInfo = Get-SharePointAdminLink -Public $false
11+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
1212
$tenantName = $SharePointInfo.TenantName
1313
$AdminUrl = $SharePointInfo.AdminUrl
1414
} else {

Modules/CIPPCore/Public/GraphHelper/Get-SharePointAdminLink.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Get-SharePointAdminLink {
44
Internal
55
#>
66
[CmdletBinding()]
7-
param ($Public)
7+
param ($Public, $TenantFilter)
88

99
if ($Public) {
1010
# Do it through domain discovery, unreliable
@@ -42,10 +42,10 @@ function Get-SharePointAdminLink {
4242

4343
# Get the onmicrosoft.com domain from the response
4444
$TenantDomains = $Response.Envelope.body.GetFederationInformationResponseMessage.response.Domains.Domain | Sort-Object
45-
$OnMicrosoftDomains = $TenantDomains | Where-Object { $_ -like "*.onmicrosoft.com" }
45+
$OnMicrosoftDomains = $TenantDomains | Where-Object { $_ -like '*.onmicrosoft.com' }
4646

4747
if ($OnMicrosoftDomains.Count -eq 0) {
48-
throw "Could not find onmicrosoft.com domain through autodiscover"
48+
throw 'Could not find onmicrosoft.com domain through autodiscover'
4949
} elseif ($OnMicrosoftDomains.Count -gt 1) {
5050
throw "Multiple onmicrosoft.com domains found through autodiscover. Cannot determine the correct one: $($OnMicrosoftDomains -join ', ')"
5151
} else {
@@ -61,8 +61,8 @@ function Get-SharePointAdminLink {
6161

6262
# Return object with all needed properties
6363
return [PSCustomObject]@{
64-
AdminUrl = "https://$tenantName-admin.sharepoint.com"
65-
TenantName = $tenantName
66-
SharePointUrl = "https://$tenantName.sharepoint.com"
64+
AdminUrl = "https://$tenantName-admin.sharepoint.com"
65+
TenantName = $tenantName
66+
SharePointUrl = "https://$tenantName.sharepoint.com"
6767
}
68-
}
68+
}

Modules/CIPPCore/Public/New-CIPPSharepointSite.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function New-CIPPSharepointSite {
6666
$Headers
6767
)
6868

69-
$SharePointInfo = Get-SharePointAdminLink -Public $false
69+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
7070
$SitePath = $SiteName -replace ' ' -replace '[^A-Za-z0-9-]'
7171
$SiteUrl = "https://$($SharePointInfo.TenantName).sharepoint.com/sites/$SitePath"
7272

Modules/CIPPCore/Public/Request-CIPPSPOPersonalSite.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ function Request-CIPPSPOPersonalSite {
3737
</Request>
3838
"@
3939

40-
$SharePointInfo = Get-SharePointAdminLink -Public $false
41-
40+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
4241
try {
4342
$Request = New-GraphPostRequest -scope "$($SharePointInfo.AdminUrl)/.default" -tenantid $TenantFilter -Uri "$($SharePointInfo.AdminUrl)/_vti_bin/client.svc/ProcessQuery" -Type POST -Body $XML -ContentType 'text/xml'
4443
if (!$Request.IsComplete) { throw }

Modules/CIPPCore/Public/Set-CIPPSPOTenant.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Set-CIPPSPOTenant {
4444
process {
4545
if (!$SharepointPrefix) {
4646
# get sharepoint admin site
47-
$SharePointInfo = Get-SharePointAdminLink -Public $false
47+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
4848
$AdminUrl = $SharePointInfo.AdminUrl
4949
} else {
5050
$tenantName = $SharepointPrefix

Modules/CIPPCore/Public/Set-CIPPSharePointPerms.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ function Set-CIPPSharePointPerms {
2121
$URL = (New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/users/$($UserId)/Drives" -asapp $true -tenantid $TenantFilter).WebUrl
2222
}
2323

24-
$SharePointInfo = Get-SharePointAdminLink -Public $false
25-
24+
$SharePointInfo = Get-SharePointAdminLink -Public $false -tenantFilter $TenantFilter
2625
$XML = @"
2726
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library">
2827
<Actions>

0 commit comments

Comments
 (0)