You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a Graph lookup for the mail contact (New-GraphGetRequest) to read AD
properties (givenName/surname/displayName) instead of relying solely on
Exchange objects. Remove the prior prebuilt ContactData, build
New-MailContact params inline, and add a remediation branch to call
Set-Contact when Graph properties differ from expected settings. Adjust
reporting to use the Graph-derived current values and the rebuilt
contact data, and keep existing logging and error handling.
# I would like to update the contact object here but exchange replication delays make it unreliable, so instead it will alert on the discrepancy until the next run - Zac
86
85
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Successfully created mail contact $($Settings.DisplayName) with email $($Settings.ExternalEmailAddress)"-sev Info
87
86
} catch {
88
87
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Could not create mail contact. $(Get-CippException-Exception $_).NormalizedError"-sev Error
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Successfully updated contact properties for $($Settings.DisplayName)"-sev Info
99
+
# I would like to update the contact object here but exchange replication delays make it unreliable, so instead it will alert on the discrepancy until the next run - Zac
100
+
} catch {
101
+
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Could not update mail contact. $(Get-CippException-Exception $_).NormalizedError"-sev Error
102
+
}
90
103
}
91
104
92
105
# Alert
@@ -101,21 +114,19 @@ function Invoke-CIPPStandardDeployMailContact {
0 commit comments