Sunday, April 29, 2012

Export the view data to notepad

Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim vw As NotesView
    Dim doc As NotesDocument
    Dim fileNum As Integer
    Dim fileName As String
    Dim fname As String
    Dim lname As String
    Set db=session.Getdatabase("jasmine06/SRVR/polarisFT","names.nsf")
    Set vw=db.Getview("($VIMPeople)")
    Set doc=vw.Getfirstdocument()
    fileNum% = FreeFile()
    fileName$ = "C:\Program Files\IBM\Lotus\Notes\Data\userlist.txt"    'mention the file path
    Open fileName$ For Output As fileNum%
    While  Not doc Is Nothing
        fname=doc.FirstName(0)
        lname=doc.LastName(0)
        Write #fileNum%, "CN=" & fname + "," + "OU="+lname +"," + "DC=polaris,DC=co,DC=in"
        Write #fileNum%
       
        Set doc=vw.Getnextdocument(doc)
       
    Wend
    Close fileNum%
   

No comments:

Post a Comment