Tip

Create registry of users from names.nsf to a text file

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.