Advertisement
gunawantw

Forwarded Address - SET

Oct 17th, 2020 (edited)
1,404
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Initialize
  2.     Dim session As New NotesSession
  3.     Dim db As NotesDatabase
  4.     Dim collection As NotesDocumentCollection
  5.     Dim doc As NotesDocument
  6.     Set db = session.CurrentDatabase
  7.     Set collection = db.UnprocessedDocuments
  8.        
  9.     Dim strFirstname, strLastName, strForwardedAddress, strShortName, strDomain As String
  10.     strDomain = "@example.com"
  11.    
  12.     Dim i As integer
  13.     For i = 1 To collection.Count
  14.         Set doc = collection.GetNthDocument( i )
  15.         strFirstName = LCase(doc.FirstName(0))
  16.         strLastName = LCase(doc.LastName(0))
  17.        
  18.         strShortName = LCase(doc.ShortName(0))
  19.        
  20.         If strShortName <> "" Then
  21.             strForwardedAddress = strShortName + strDomain
  22.         Else
  23.             strForwardedAddress = strFirstName + "." + strLastName + strDomain         
  24.         End If
  25.        
  26.         'MsgBox strForwardedAddress
  27.        
  28.         Call doc.ReplaceItemValue("MailSystem","5")
  29.         Call doc.ReplaceItemValue("MailAddress",strForwardedAddress)
  30.         Call doc.save(True,True)
  31.        
  32.     Next
  33.    
  34. End Sub
Advertisement
RAW Paste Data Copied
Advertisement