From 72bf9b869ad9797499dd6b2f6332aa7b1ce6de56 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Mon, 25 Sep 2023 17:23:22 +0200 Subject: [PATCH 1/4] fixes version get --- GetCippAlerts/run.ps1 | 2 +- GetVersion/run.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GetCippAlerts/run.ps1 b/GetCippAlerts/run.ps1 index 554b25300eb2..af791ee99012 100644 --- a/GetCippAlerts/run.ps1 +++ b/GetCippAlerts/run.ps1 @@ -16,7 +16,7 @@ $APIVersion = Get-Content "version_latest.txt" | Out-String $CIPPVersion = $request.query.localversion $RemoteAPIVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP-API/master/version_latest.txt" -$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/version_latest.txt" +$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/public/version_latest.txt" $version = [PSCustomObject]@{ LocalCIPPVersion = $CIPPVersion diff --git a/GetVersion/run.ps1 b/GetVersion/run.ps1 index cf7a33c72ae0..d0e092e20571 100644 --- a/GetVersion/run.ps1 +++ b/GetVersion/run.ps1 @@ -10,7 +10,7 @@ $APIVersion = Get-Content "version_latest.txt" | Out-String $CIPPVersion = $request.query.localversion $RemoteAPIVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP-API/master/version_latest.txt" -$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/version_latest.txt" +$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/public/version_latest.txt" $version = [PSCustomObject]@{ LocalCIPPVersion = $CIPPVersion From 77756095a2131398b1aed8cf4bf5bc01134073cd Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Mon, 25 Sep 2023 17:23:52 +0200 Subject: [PATCH 2/4] hotfix --- version_latest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version_latest.txt b/version_latest.txt index 81911389142b..ecedc98d1d5a 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.3.0 \ No newline at end of file +4.3.1 \ No newline at end of file From b392ea9cf99c32c4a3a3335032c2f48441b27539 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Tue, 26 Sep 2023 18:52:41 +0200 Subject: [PATCH 3/4] fixed adding guests to DL --- EditGroup/run.ps1 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/EditGroup/run.ps1 b/EditGroup/run.ps1 index d03055ceecd3..b07c51572508 100644 --- a/EditGroup/run.ps1 +++ b/EditGroup/run.ps1 @@ -18,7 +18,8 @@ if ($AddMembers) { $AddMembers | ForEach-Object { try { $member = $_ - $MemberIDs = "https://graph.microsoft.com/v1.0/directoryObjects/" + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($_)" -tenantid $Userobj.tenantid).id + if ($member -like '*#EXT#*') { $member = [System.Web.HttpUtility]::UrlEncode($member) } + $MemberIDs = "https://graph.microsoft.com/v1.0/directoryObjects/" + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($member)" -tenantid $Userobj.tenantid).id $addmemberbody = "{ `"members@odata.bind`": $(ConvertTo-Json @($MemberIDs)) }" if ($userobj.groupType -eq "Distribution list" -or $userobj.groupType -eq "Mail-Enabled Security") { $Params = @{ Identity = $userobj.groupid; Member = $member; BypassSecurityGroupManagerCheck = $true } @@ -47,11 +48,12 @@ if ($AddContacts) { New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-DistributionGroupMember" -cmdParams $params -UseSystemMailbox $true Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "Added $member to $($userobj.groupid) group" -Sev "Info" $body = $results.add("Success. $member has been added") - } else { - Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "You cannot add a contact to a security group" -Sev "Error" - $body = $results.add("You cannot add a contact to a security group") + } + else { + Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "You cannot add a contact to a security group" -Sev "Error" + $body = $results.add("You cannot add a contact to a security group") + } } - } catch { $body = $results.add("Failed to add member $member to $($userobj.Groupid): $($_.Exception.Message)") } @@ -149,16 +151,16 @@ if ($userobj.allowExternal -eq 'true') { if ($userobj.sendCopies -eq 'true') { try { - $Params = @{ Identity = $userobj.Groupid; subscriptionEnabled = $true; AutoSubscribeNewMembers = $true } - New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Set-UnifiedGroup" -cmdParams $params -useSystemMailbox $true + $Params = @{ Identity = $userobj.Groupid; subscriptionEnabled = $true; AutoSubscribeNewMembers = $true } + New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Set-UnifiedGroup" -cmdParams $params -useSystemMailbox $true - $MemberParams = @{ Identity = $userobj.Groupid; LinkType = "members" } - $Members = New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Get-UnifiedGrouplinks" -cmdParams $MemberParams + $MemberParams = @{ Identity = $userobj.Groupid; LinkType = "members" } + $Members = New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Get-UnifiedGrouplinks" -cmdParams $MemberParams - $MemberSmtpAddresses = $Members | ForEach-Object { $_.PrimarySmtpAddress } + $MemberSmtpAddresses = $Members | ForEach-Object { $_.PrimarySmtpAddress } - $subscriberParams = @{ Identity = $userobj.Groupid; LinkType = "subscribers"; Links = @($MemberSmtpAddresses) } - New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-UnifiedGrouplinks" -cmdParams $subscriberParams -Anchor $userobj.mail + $subscriberParams = @{ Identity = $userobj.Groupid; LinkType = "subscribers"; Links = @($MemberSmtpAddresses) } + New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-UnifiedGrouplinks" -cmdParams $subscriberParams -Anchor $userobj.mail $body = $results.add("Send Copies of team emails and events to team members inboxes for $($userobj.mail) enabled.") From 746ad134bcc7e0b453ef772f0a5d3c59ef106b8b Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Tue, 26 Sep 2023 18:55:19 +0200 Subject: [PATCH 4/4] include errors hotfix --- GraphHelper.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GraphHelper.psm1 b/GraphHelper.psm1 index 0be92f2e26d4..7cf967bd4c6d 100644 --- a/GraphHelper.psm1 +++ b/GraphHelper.psm1 @@ -552,7 +552,7 @@ function Remove-CIPPCache { function New-ExoRequest ($tenantid, $cmdlet, $cmdParams, $useSystemMailbox, $Anchor, $NoAuthCheck) { if ((Get-AuthorisedRequest -TenantID $tenantid) -or $NoAuthCheck -eq $True) { $token = Get-ClassicAPIToken -resource 'https://outlook.office365.com' -Tenantid $tenantid - $tenant = (get-tenants | Where-Object -Property defaultDomainName -EQ $tenantid).customerId + $tenant = (get-tenants -IncludeErrors | Where-Object -Property defaultDomainName -EQ $tenantid).customerId if ($cmdParams) { $Params = $cmdParams }