Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract data from names.nsf through VB to .txt file

Status
Not open for further replies.

stevenvanaken

Programmer
May 7, 2013
1
0
0
US
I have Visual Basic 2010 express and Lotus Notes 8.5.

I would like to extract (to txt) the entries from the names.nsf. The output is nothing, although I use the proper VB script:

Dim ses As New Domino.NotesSession, str_DbName As String, str_nsf As String
Dim db As Domino.NotesDatabase, dc As NotesView, doc As Domino.NotesDocument

str_DbName = <database name>
str_nsf = <database file location>

Call ses.Initialize()
db = ses.GetDatabase(str_DbName, str_nsf, False)

If db.IsOpen Then
Dim str_User_ID
Dim FileSyst As Object = CreateObject("Scripting.FileSystemObject")
Dim ExportFile As Object = FileSyst.CreateTextFile("c:\temp\Address_Book.txt", True)

Dim str_User_ID
dc = db.GetView("People")
doc = dc.GetFirstDocument

While Not (doc Is Nothing)
str_User_ID = doc.GetItemValue("ShortName")
ExportFile.WriteLine(str_User_ID(0) & Chr(9))
doc = dc.GetNextDocument(doc)
End While
ExportFile.Close()
Else
Rem Does not exist
End If
Exit Sub

I assume I'm not using the right view, however this is what I see in the names.nsf. Can somebody assist me in resolving this, please?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top