0

Using Powershell, I need to retrieve an Internet email address from a Lotus Notes names.nsf address book.

Within Notes, I can see the internet email address I want to retrieve. It is on the Basics tab, under the Mail section, in a field called "Internet Address". However, I have not been able to find the view it is under, or a way to query it or derive it. It would also be helpful to filter the email addresses I would like to find by the Company on the "Work/Home" tab in Lotus Notes.

Opening one of the names.nsf files in IE, I see a number of the fields I want, but a formatted internet email address isn't in there. All I see is the Lotus notes style of email address:

firstname lastname/mycompany/abc @ abc

(The column name that is in is named $16).

Is there a way to pull the full internet email addresses from a Lotus Notes names.nsf address book? If so, how? If they are in some of the "hidden" views available, how do you query the values in those hidden views?

Thanks!

steve_o
  • 1,243
  • 6
  • 34
  • 60

2 Answers2

2

In many cases, the best view to use for finding Person documents is the hidden view called "$Users". It is indexed by just about every variation of the name that you can think of, so lookups just tend to work. You can find it by opening the Person document from the view and reading the NotesItem named "InternetAddress", or you can read it directly from the view column that is labled "InternetAddress", which I believe is the 17th column.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • How do you query/list the ($Users) hidden view? I can see ($Users) when I list off the views available, but cannot seem to get to any of the items in it. – steve_o Mar 05 '13 at 13:37
  • 1
    The best documentation for the Notes classes is in the Domino Designer help files. I suggest you install it and use it for reference even though you are not using it for actual development. Since you haven't shown any of your code, and I don't know PowerShell or anything about how you are trying to write this code, the best I can do is show you one of the ways it could be done in LotusScript. set myView =Database.getView("$Users"); set myEntry = myView.GetEntryByKey("username goes here",true); myInternetAddress = myEntry.columnValues(18). (I'm not 100% sure about that value 18.) – Richard Schwartz Mar 05 '13 at 15:41
  • I discovered what I had been doing wrong - I was selecting the first document & not grabbing anything subsequent to it. It was returning the same null document every time. I do have a subsequent question though - I am doing a $doc = $view.getfirstdocument() then a while $doc -ne $null going thru & grabbing meaningful data - $internetAddress = [string] $doc.GetItemValue("InternetAddress") and writing it out. However, I found out there are duplicates in the $Users view. How can I do the while and yet grab only the distinct values (without >1 pass)? – steve_o Mar 05 '13 at 17:33
  • 1
    I assumed that you just wanted to find a single user because the wording of your question said "retrieve an internet email address", and $Users is the right view for that. But if I had understood that what you want to do is iterate through email addresses for all users, then I would not have recommended $Users -- because of all the duplicate view entries. Sorry for the confusion. For what you actually want, and the way you are coding it, you should use the "People" view instead of $Users. – Richard Schwartz Mar 05 '13 at 19:56
0

You can access all of the properties for a given user from the NAB using powershell. You must run the 32 bit version of PS if your Notes client is 32 bit. You will be prompted for your Notes ID password.

  $notes=new-object -comobject Lotus.NotesSession;
  $notes.Initialize("");
  $ndb = $notes.getdatabase("admin","names.nsf");
  $nview = $ndb.getview('($Users)');
  $searchkey = "Schmoe"; #whatever
  $doc =$nview.getdocumentbykey($searchkey,$true);
  $mailaddress = $doc.getitemvalue('mailaddress')[0];
  $internetaddress = $doc.getitemvalue('internetaddress')[0];
bigguitar
  • 1
  • 1