Home > Domino Tips > Administrator > Address Book > Create registry of users from names.nsf to a text file
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ADDRESS BOOK

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


Miguel Vives
12.16.2002
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.



Code

- 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

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Address Book
Formula language button manages Deny Access list searches
Find a Lotus Notes user within NAB Deny Access groups
Synchronize LinkedIn contacts with Lotus Notes Domino
How to correct Lotus Notes public key mismatches in four easy steps
Creating a Lotus Notes Personal Address Book replica
Admin user unable to create NAB
@Transform formula for use in R6
Change NAB while maintaining integrity of documents
NAB: A key piece of the Domino administration puzzle
Build an extended directory catalog

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts