MAExtension_LDAPMailAliases.vb: exportRfc822MailMember, exportDescription

This code is somewhat simplified as it is here to demonstrate the populating of the description field. The rfc822MailMember field is multivalued so it is not as simple as setting it equal to a string value, but for the sake of the example we’ll assume it is restricted to one value.

Case “exportRfc822MailMember”
    Dim objWriter As StreamWriter
    Dim newValue As String
    Dim comment As String
     <<Code to determine if a new Value is needed. Sets the comment variable to decribe the change. >>
    If Not newValue is Nothing Then
        csentry(“rfc822MailMember”).Value = newValue
        objWriter = New StreamWriter(LDAPParams(“alias-updated-list”), True)
        objWriter.Writeline(csentry.DN.ToString & “#” & comment)
    End If

Case “exportDescription”
‘Input: none – forces rule to run each time 
    Dim objReader As StreamReader
    Dim objWriter As StreamWriterobjReader = New StreamReader(LDAPParams(“alias-updated-list”)) 
    Dim listItem As String
    Dim list As String = “”
    While objReader.Peek >= 0
        listItem = objReader.ReadLine
        If listItem.Split(“#”)(0) = csentry.DN.ToString Then
             csentry(“description”).Values.Add(“Updated by MIIS on ” & Today() & “, ” & listItem.Split(“#”)(1))
            list = list & listItem & vbCrLf
      End If
    End While
    objWriter = New StreamWriter(LDAPParams(“alias-updated-list”), False)