Solved

How do I change the $Saved Addresses field on my domino server address book and for all clients address books?

Posted on 2009-07-02
31
871 Views
Last Modified: 2013-12-18
The $Saved Addresses contains an invalid FQDN that I need to change in order for failover to work.
0
Comment
Question by:jvutechnc
  • 11
  • 11
  • 5
  • +1
31 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 24761804
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24761866
I'm not changing my companies domain name so I don't see how that code will help.   The $SavedAddresses is used to to help the notes client locate a domino server.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24761897
Notice the word change in my comment.
The code I posted contains functions (which you don't have to change) GetLocationItem and SetLocationItem!

The field you want to change is located in "Location Documents", isn't it (both server and local NABs)? So I thought SetLocationItem could help ;)

You have a field $SavedServers (which you also may want to change).
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 22

Expert Comment

by:mbonaci
ID: 24761904
Also, the request in the question I referred to wasn't to change domain name, but to change mail addresses in location docs.
0
 
LVL 6

Expert Comment

by:LotusDave
ID: 24761925
Rather than change them you can just dlete them and then they will get re-populated. Here's a couple of agents that you can use in buttons -

For the user -

Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim port As Variant
Set db=session.GetDatabase(",NAMES.NSF)
Set view=db.GetView(Locations)
Set doc=view.GetFirstDocument
While Not (doc Is Nothing)
Call doc.RemoveItem($SavedAddresses)
Call doc.RemoveItem($SavedPorts)
Call doc.RemoveItem($SavedServers)
Call doc.save(True,True)
Set doc=view.GetNextDocument(doc)
Wend
Messagebox(Removing Cached Addressed Completed)
End Sub

And for the Domino Directory -

Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim port As Variant
Dim whichserver As String
whichserver=Inputbox$(Which server?)
Set db=session.GetDatabase(whichserver,NAMES.NSF)
Set view=db.GetView(Locations)
Set doc=view.GetFirstDocument
While Not (doc Is Nothing)
Call doc.RemoveItem($SavedAddresses)
Call doc.RemoveItem($SavedPorts)
Call doc.RemoveItem($SavedServers)
Call doc.save(True,True)
Set doc=view.GetNextDocument(doc)
Wend
Messagebox(Removing Cached Addressed Completed)
End Sub

0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24761992
Thank you for the Agents!  I will use them later and will get back to you.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24762203
What's wrong with a simple Formula agent, running on selected documents, with only these lines:

Field $SavedAddresses:= @DeleteField;
Field $SavedPorts:= @DeleteField;
Field $SavedServers:= @DeleteField
0
 
LVL 6

Expert Comment

by:LotusDave
ID: 24762362
Sjef, in my experience, most users don't know how to find location documents, even if you tell them :-)
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24762367
IMHO, the point of this problem is how to push changes to all local NABs, not how to change the fields (that's no-brainer).
Of course, there's nothing wrong, deleting the fields will work the same as replacing the value with empty string (SetLocationItem).

Nevertheless, you'll have to create e-mail in which you'll paste the button and then sent that mail to all users.
Other option is to create empty db on the server, place the code on the page that opens automatically, and send db link in e-mail, but the button_in_mail solution is simpler than that.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24762405
Yes... That may be true but... If someone knows about the field $Saved Addresses, which is a field in a Location document, one might expect that that person knows how to find a Location document...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24762442
I assume it wasn't a no-brainer for jvutechnc, Marko.
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24762460
LotusDave,

Are those formulas you provided or is it java or javascript?  What do I select from the drop down box when I past your code into the body?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24762473
That's why I stated that IMHO he wasn't asking that (no-brainer = trivial, isn't it).
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24762483
Or is it Lotusscript that LotusDave provided?  I get all sorts of errors when I try to save your agent code.  Please advise me on how to put this into a button. Thank you again!
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24762570
- create new form
 - create new button on it
 - in button's events (code) paste function SetLocationItem (go to Options and paste there - you'll see function created)
 - Then in buttons Click event type this:

Call SetLocationItem( "$SavedAddresses", "" )
Call SetLocationItem( "$SavedPorts", "" )
Call SetLocationItem( "$SavedServers", "" )

Then copy the button to new memo that you'll send to users with instructions to click on it.
0
 
LVL 6

Assisted Solution

by:LotusDave
LotusDave earned 200 total points
ID: 24763152
Sorry, I just copied it from our LotusScript library without checking and there are errors - here's the corrected version for the user button. I see you have been given other alternatives so maybe you don't need this now -

Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument
      Dim port As Variant
      
      Set db = session.GetDatabase("", "names.nsf")
      Set view =db.GetView("Locations")
      Set doc=view.GetFirstDocument
      While Not (doc Is Nothing)
            Call doc.RemoveItem("$SaveAddresses")
            Call doc.RemoveItem("$SavedPorts")
            Call doc.RemoveItem("$SavedServers")            
            Call doc.save(True,True)
            Set doc=view.GetNextDocument(doc)
      Wend
      Messagebox "Removing Cached Addressed Completed"
      
End Sub

0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24763252
mbonaci,

Where is:

 - in button's events (code) paste function SetLocationItem (go to Options and paste there - you'll see function created)

Thank you.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24763519
Create a button, click on it and where it says

     Run: 'Client'     'Formula'

select LotusScript. Events appear on the left.

See the image
Clipboard01.gif
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24763542
When you copy the code don't forget to select GetLocalNAB function in the code window.
Simply select all the code from my first post there and paste in Options event.
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24767074
LotusDave,

Your revised client lotusscript worked great.  How about the one script for the server's directory?  I tried using but it had errors.  Any thoughts?
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24767119
mbonaci,

I'd like to try your code but I can't figure out what you're saying.  I'm very experienced with coding so I appreciate if you can list step by step what needs to be done in order to do what you suggest.  Thank you.
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24769033
So Again, I would like to change the $SavedAddresses field; I've included a picture that shows the entry jnpbackup2.janpakint.com.  I need to change it to jnpbackup2.janpak.com.

thank you.

Savedaddresses.gif
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24770501
Instead of
      Call doc.RemoveItem("$SaveAddresses")
use
      Dim v As Variant
      v= Evaluate(|@Replace($SaveAddresses,"jnpbackup2.janpakint.com","jnpbackup2.janpak.com")|, doc)
      Call doc.ReplaceItemValue("$SaveAddresses", v)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24779284
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24783345
I posted step by step instructions, so can you rather answer:
Where did you get stuck? Which step isn't understandable for you and I'll clarify?

I'm repeating the instructions here (in my previous post I included the image for step 3 so it's easier for you to find the Options section where you should paste the code):

 1.  create new form
 2.  create new button on it
 3.  in button's events (code) paste function the code I'm repeating bellow (go to Options and paste there - you'll see two functions created)
 4.  then in buttons Click event type this (I included Sjef's code in order to leave other entries the users may have - intact):

Dim v As Variant
v= Evaluate(|@Replace($SaveAddresses,"jnpbackup2.janpakint.com","jnpbackup2.janpak.com")|, doc)

Call SetLocationItem( "$SavedAddresses", v )


Then copy the button (select it on form, in Designer and paste it to new mail memo) to new memo that you'll send to users with instructions to click on it.
Sub SetLocationItem( itemname As String, itemvalue As Variant )
        'Mb¤, 14.02.2005.
        'This procedure sets an item "itemname" to value itemvalue in the current user's location doc
        Dim PrivateAddressBook As notesdatabase
        Dim CurrentLocation As notesdocument
        Dim LocationString As String, strTemp As String, LocationID As String
 
        'Set PrivateAddressBook = New Notesdatabase( "", "names.nsf" )
        Set PrivateAddressBook = GetLocalNAB()
        
        If PrivateAddressBook Is Nothing Then
                Print "Cannot get your local address book."
                Exit Sub
        End If
        
        LocationString = Session.GetEnvironmentString( "Location", True )
        
        If LocationString <> "" Then
                strTemp = Mid( LocationString, ( Instr( 1, LocationString, "," ) + 1 ) )
                LocationID = Left( strTemp, ( Instr( 1, strTemp, "," ) -1 ) )
                Set CurrentLocation = PrivateAddressBook.GetDocumentByID( LocationID )
                If Not CurrentLocation Is Nothing Then
                        Call CurrentLocation.ReplaceItemValue( itemname, itemvalue )
                        Call CurrentLocation.Save( True, False )
                Else
                        Msgbox |Unable to get current location document. Check notes.ini setting "Location".|
                        Exit Sub
                End If
        Else
                Msgbox "Unable to get the location settings. Location setting in your notes.ini is empty."
                Exit Sub
        End If     
End Sub
 
Function GetLocalNAB() As NotesDatabase
        Dim sAddressBook As String
        Dim nCommaLocation As Integer
        
        On Error Resume Next
        sAddressBook = session.GetEnvironmentString( "NAMES", True )
        nCommaLocation = Instr( sAddressBook, "," )
        If nCommaLocation > 0 Then sAddressBook = Left( sAddressBook, nCommaLocation - 1 )
        
        Set GetLocalNAB = New NotesDatabase( "", sAddressBook )
End Function

Open in new window

0
 
LVL 22

Accepted Solution

by:
mbonaci earned 300 total points
ID: 24783487
0
 
LVL 6

Assisted Solution

by:LotusDave
LotusDave earned 200 total points
ID: 24783612
Hi, I've been away for a few days but saw your request for the corrected server version of the agents I supplied, here it is, drop this Lotuscript between the Sub Click(Source As Button) and End Sub lines

      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument
      Dim port As Variant
      Dim whichserver As String
      whichserver=Inputbox$("Which Server?")
      
      Set db=session.GetDatabase(whichserver,"names.nsf")
      Set view=db.GetView("$Locations")
      
      Set doc=view.GetFirstDocument
      While Not (doc Is Nothing)
            Call doc.RemoveItem("$SavedAddresses")
            Call doc.RemoveItem("$SavedPorts")
            Call doc.RemoveItem("$SavedServers")
            
            Call doc.save(True,True)
            Set doc=view.GetNextDocument(doc)
      Wend
      Messagebox("Removing Cached Addresses Completed")
      
Good luck,
Dave
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24784977
Thank you to everyone for your help on this!!  So far I've used Lotus Dave's client script and also made a change in my Server Documents "Notes Ports" to have the correct FQDN for the servers.  

I want to test and use all your answers in order to find what will work best in my situation.  As a result, I will not close this request at this time but will continue to verify your answers over the next few days.

Thank you!
0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24823285
mbonaci,

Can I simply add another FQDN to the following line??  I want to add janpak.com also.  What would be the syntax?

Call SetLocationItem( "$SavedAddresses", "jnpbackup2.janpak.com" )

Thank you for reposting you working code on openntf.org.  I used it and I especially like the email message it returns!!  Awesome.  

Thank you LotusDave and everyone else for your posts and suggestions. I decided I will use Mbonaci's code to populate the $SavedAddresses field.
0
 
LVL 22

Assisted Solution

by:mbonaci
mbonaci earned 300 total points
ID: 24823632
To place multiple values in a field you'll have to do it using array, like this:
Dim valueArray(1) As String
 
valueArray(0) = "jnpbackup2.janpakint.com"
valueArray(1) = "jnpbackup2.janpak.com"
 
 
Call SetLocationItem( "$SavedAddresses", valueArray )

Open in new window

0
 
LVL 3

Author Comment

by:jvutechnc
ID: 24826581
mbonaci,

Thank you for that array code.

Thank you to everyone.  Farewell!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
authenticating IIS users via a Lotus Domino Server 5 185
Lotus Notes and VMWare require a double-click 22 1,400
Domino Server 2 77
Lotus Domino 9 relay to Office 365 Exchange Online 5 110
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question