FIM/MIM - Update on my Generic Array From File post
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
Public Class MAExtensionObject_MYADMA | |
Implements IMASynchronization | |
'Date & Logginglevel variables for logging files: | |
Dim dtDateNowHour As Integer = Date.Now.Hour | |
Dim dtDateNowDay As Integer = Date.Now.Day | |
Dim dtDateNowMonth As Integer = Date.Now.Month | |
Dim dtDateNowYear As Integer = Date.Now.Year | |
Dim loggingLevel As Integer = 0 | |
' | |
Dim ValidMailSuffixes As ArrayList = generateArrayFromFile("C:\FIMControl\ValidMailSuffixes.txt") ' Extra suffixes can be added to the text file defined here | |
Dim IgnoreFunctionalIDOwner As ArrayList = generateArrayFromFile("C:\FIMControl\IgnoreFunctionalIDOwner.txt") ' Extra odd functionalID owners can be added to the text file defined here | |
Dim IgnoreEmailAddressErrors As ArrayList = generateArrayFromFile("C:\FIMControl\IgnoreEmailAddressErrors.txt") ' Extra odd email addresses can be added to the text file defined here | |
' | |
Public Function generateArrayFromFile(ByVal file As String) As ArrayList | |
Dim arrayFromFile As New ArrayList() | |
Try | |
Dim reader As New System.IO.StreamReader(file) | |
While Not (reader.Peek() = -1) | |
arrayFromFile.Add(reader.ReadLine()) | |
End While | |
reader.Close() | |
reader.Dispose() | |
Catch ex As IOException | |
arrayFromFile.Add(ex.ToString()) | |
End Try | |
Return arrayFromFile | |
End Function |
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), "@") | |
If ValidMailSuffixes.Contains(suffix(1).ToLower) Then | |
mventry("emailAddressPresent").Value = "True" | |
Else | |
'If a suffix from the above is not found - raise an error, so that the suffix can be added to the text file or simply sorted out - where a mistake was made. | |
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