With this script you can generate a text file to migrate all the
people from a directory (names.nsf R4) to another new directory (names.nsf R5),
later import from Domino Administrator to your new server.
- OPTIONS
Option Public
Option Explicit
Option Compare Nocase
%REM
AUTOR: Miguel Vives (23/05/02)
MODIFICADO: Miguel Vives (16/12/02)
%END REM
- DECLARATIONS
Dim DBFILE As String
Dim SERVER As String
Dim FILEPATH As String
Dim fileName As String
Dim fileNum As Integer
Dim SRVCORREO As String
Dim PLTCORREO As String
Dim CERTIFICADOR As String
Dim IDOMINIO As String
Dim EDIRECTORIO As String
Sub Initialize
REM FORMATO FICHERO PARA EL REGISTRO DE USUARIOS DESDE UN FICHERO DE TEXTO
REM Apellido;Nombre;Inicial del segundo nombre;Unidad organizativa;ContraseÑa;
REM Directorio para el archivo ID;Nombre del archivo ID;Nombre del servidor de correo;
REM Directorio para el archivo de correo;Nombre del archivo de correo;UbicaciÓn;Comentario;
REM DirecciÓn de correo;Nombre de perfil;Administrador Local;DirecciÓn de internet;Nombre abreviado;
REM Nombre alternativo;Unidad organizativa alternativa;Archivo de plantilla de correo
REM AUTOR Miguel Vives
On Error Goto Salir
Dim session As New NotesSession
Dim dbx As NotesDatabase
Dim viewx As NotesView
Dim docx As NotesDocument
Dim S As String, CR As String
Dim i As Integer
S = ";"
CR = Chr$(10)
DBFILE = "names.nsf" 'Directory name
SERVER = "Pruebas02/ADMINISTRADOR" 'session.CurrentDatabase.Server IS THE SCRIPT RUN ON SERVER 'Server name
IDOMINIO = "@ibm.es" 'Domain name
SRVCORREO = "Pruebas02" 'Mail Server name
CERTIFICADOR = "/Migracion" 'Certifier name
EDIRECTORIO = "mail" 'subdirectory name
PLTCORREO = "mail50ex.ntf" 'Template name
fileNum% = Freefile()
fileName$ = "c:\notesaltas.txt"
Open fileName$ For Output As fileNum%
Set dbx = session.GetDatabase( SERVER, DBFILE )
Set viewx = dbx.GetView( "People" )
Set docx = viewx.GetFirstDocument
While Not ( docx Is Nothing )
With docx
Print #fileNum%, .LastName(0) & S & .FirstName(0) & S & .MiddleInitial(0) & S & S & FCon(docx) & S &_
S & FIDfile(docx) & S & SRVCORREO & S &_
EDIRECTORIO & S & FBuzon(docx) & S & S & S &_
FCorreo(docx) & S & S & S & FEmail(docx) & S & Lcase$( .ShortName(0) ) & S & _
S & S & PLTCORREO & CR
End With
Set docx = viewx.GetNextDocument( docx )
Wend
Write #fileNum%
Close fileNum%
Messagebox "Consulte el fichero de altas llamado '" & fileName$ & "' .", 64, "Fin de proceso"
i = Shell ( "NOTEPAD.EXE " & fileName$ , 1 )
Exit Sub
Salir:
Close fileNum%
Messagebox Str(Err) & " - " & Error, 16, "Error de programa"
Exit Sub
End Sub
Function FBuzon (docx As NotesDocument) As String
Dim pos As Integer
Dim aux As String
With docx
pos = Instr(1, .MailFile(0), "\")
If ( pos = 0 ) Or ( pos = Null ) Then
FBuzon = ""
Else
FBuzon = Lcase$( Mid$( .MailFile(0), ( pos + 1 ), Len(.MailFile(0)) ) )
End If
End With
End Function
Function FEmail (docx As NotesDocument) As String
With docx
FEmail = Lcase$( .ShortName(0) & IDOMINIO )
End With
End Function
Function FCorreo (docx As NotesDocument) As String
With docx
Dim userName As New NotesName( .FullName(0) )
FCorreo = userName.Common & CERTIFICADOR
End With
End Function
Function FIDfile (docx As NotesDocument) As String
With docx
FIDfile = Lcase$( Left$(.FirstName(0),1) & .LastName(0) & ".id")
End With
End Function
Function FCon (docx As NotesDocument) As String
REM Password: Miguel Vives --> mvives
With docx
FCon = Lcase$( Left$(.FirstName(0),1) & .LastName(0) )
End With
End Function
This was first published in December 2002