1

I have specific problem. I need to extract domain names from active directory and combine them with employees numbers which are in Lotus Notes. I get the domain names with Get-QADUser (snapin from quest.com), that was no problem, but how to get the employees numbers and combine them? Thank you

Edit(18.5. 11:56): Now I'm using this script (posted by Christian) and I figured out how to get the name of LN database - right-click on DB in Lotus notes workspace, then application/properties.

# Create LN Object
$DomSession = New-Object -ComObject Lotus.NotesSession

# Initialize LN Object
# You'll be asking for LN password to your id
$DomSession.Initialize()

# Connect to Server, select db and display the name
$DomDatabase = $DomSession.GetDatabase("LN007","IT\HW.nsf")
Write-Host "Database open : " $DomDatabase.Title

# Open specific View (By Serial Number)
$DomView = $DomDatabase.GetView('Serial Number')
Write-Host "View read : " $DomView.Name

# Show number of documents
$DomNumOfDocs = $DomView.AllEntries.Count
Write-Host "Num of Docs : " $DomNumOfDocs

# Get First Document in the View
$DomDoc = $DomView.GetFirstDocument()
culter
  • 5,487
  • 15
  • 54
  • 66

3 Answers3

2

If you have access to the database and a Notes client, you can open the database in Notes Designer and review what views are available. You should then be able to find one or create one that contains the data you need.

If you don't have access to Lotus Notes, you're close enough with your powershell script that you can use the com API to get the information. The NotesDatabase object (i.e. $DomDatabase) has a Views property which will return NotesView objects. You can iterate over those and print out the names as a start. Likewise once you've found the view you want, you can access the columns within that view using the NotesView's Columns property.

You'll want to check out the COM api docs here for more help: http://blagoevgrad.court-bg.org/help/help85_designer.nsf/Main?OpenFrameSet (see the section LotusScript/COM/OLE Classes)

Depending on how comfortable you are with Powershell vs the com api, you could probably handle this a few ways, either by extracting all the documents in the view and getting the data out, or perhaps using the built in NotesView.GetDocumentByKey method that would act as a lookup in your script. With a view sorted on the key you're querying on (and set as your view's first column), you could call that method and get back the document with that key. Then use that NotesDocument object to retrieve any value within it (i.e. the employee name or number or whatever)

Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
1

You can retrieve data from Lotus Notes using com object.

Suggested links:

http://davidmoravec.blogspot.it/2008/08/retrieve-data-from-lotus-notes-with.html

Lotus Notes comobject

CB.
  • 58,865
  • 9
  • 159
  • 159
  • Thank you, Christian. I've read david moravec's blog, but his script doesn't work for me, because I don't know name of the database with user names and their numbers. Is it possible (without LN administrator) to figure out the name of DB with users? – culter May 18 '12 at 08:12
  • You can ask your LN Administrator to populate a LNDB with data you need and give to you read access permissions. I used com object to retrieve data from LN but from DB where I had read/write access. – CB. May 18 '12 at 08:17
  • Ok, as I mentioned above, I'm using this script and I successfully connected to LN database, but I dont know what to enter instead of "Serial Number" in View read.. – culter May 18 '12 at 10:00
  • If you are doing Domino development and there's nobody available to tell you the names of the design elements that you need to access, then get yourself a copy of Domino Designer and the Notes client. It's a single install for both, and it is free software. You must be a licensed user to use it to access a server, but if you're accessing a server for development you should already be licensed. Use Designer to open the database on the server and examine the views. Use the Notes client to verify what's in the views, and look at document properties to get item names. – Richard Schwartz May 18 '12 at 14:17
  • 1
    Another useful tool, also free to licensed users, is NotesPeek. This will give you a tree view of the database internals. – Richard Schwartz May 18 '12 at 14:18
1

Is the database you are opening called "names.nsf" by any chance? If so, that's the standard Domino Directory database and you should be using the "People" view, and the item name you are looking for should be "EmployeeID" -- unless the customer has customized the database with their own field names.

If it is a custom database you are working with, then in addition to using the Notes client and Domino Designer, get yourself a copy of NotesPeek. It's free. Download here

It gives you a tree view of the database. It shows you everything that is stored in the database -- but it only shows you what is stored, so computed fields that you can see in the Notes client but aren't accessible through the Notes classes won't confuse you. (The document properties dialog in the Notes client won't show you computed values either if you use it while you have a document selected in a view, but it will show them to you if you use while you have a document actually open.)

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41