Skip to content

Instantly share code, notes, and snippets.

@jkbryan
Created November 8, 2017 21:18
Show Gist options
  • Save jkbryan/a25bb44b3ea124c0f0010b22783cef98 to your computer and use it in GitHub Desktop.
Save jkbryan/a25bb44b3ea124c0f0010b22783cef98 to your computer and use it in GitHub Desktop.
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