Created
October 2, 2018 20:22
-
-
Save jkbryan/bf8df637bfea4b663f89bcb53c5d0343 to your computer and use it in GitHub Desktop.
initial-emailaddresspresent-adma-import.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Case "emailAddressPresent-ADMA-Import" | |
'AD attributes required: mail and msExchHomeServerName | |
' Default setting = False | |
mventry("emailAddressPresent").Value = "False" | |
If csentry("mail").IsPresent And csentry("msExchHomeServerName").IsPresent Then | |
Dim suffix() As String = Split((csentry("mail").Value), "@") | |
'Valid/allowed email suffixes are defined in the following array (amend as appropriate): | |
Dim validMailAddresses() As String = {"blah.ac.uk", "foo.ac.uk", "bar.ac.uk", "otherorg.ac.uk"} | |
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. Rare! | |
Throw New Exception("Invalid email suffix found: " & suffix(1)) | |
End If | |
ElseIf csentry("mail").IsPresent And csentry("mailNickName").IsPresent Then | |
'This person is a mail enabled user, maybe with an island site email address or just something else, so we want them to be able to be added to distribution lists.... | |
mventry("emailAddressPresent").Value = "True" | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment