Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Case "emailAddressPresent-ADMA-Import"
'AD attributes required: mail and msExchHomeServerName
If csentry("mail").IsPresent And csentry("msExchHomeServerName").IsPresent Then
Dim mail As String = csentry("mail").Value
Dim suffix() As String = mail.Split("@")
'Valid/allowed email suffixes are defined in the following array (amend as appropriate):
Dim validMailAddresses() As String = {"blah.org", "blah.ac.uk", "blah.org.uk", "laserz.org"}
If (Array.IndexOf(validMailAddresses, suffix(1).ToLower) > -1) Then
mventry("emailAddressPresent").Value = "True"
Else
'If a suffix from the array is not found - raise an error, so that the suffix can be added to the array or simply sorted out - where a mistake was made.
Throw New Exception("Invalid email suffix found: " & suffix(1))
End If
ElseIf Not csentry("msExchHomeServerName").IsPresent Then
mventry("emailAddressPresent").Value = "False"
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.