Lotusscript agent to update PNAB

Could someone please tell me why the following code fails to update the Locations in the personal address book.

Dim db As NotesDatabase

Dim v As NotesView

Dim doc As NotesDocument

Set db = New NotesDatabase (“”, “names.nsf”)

Set v= db.GetView (“locations”)

Set doc = v.GetFirstDocument

doc.mailserver = “new server”

Do Until doc Is Nothing

Call doc.Save (True, False)

Set doc = v.GetNextDocument (doc)

Loop

Subject: Lotusscript agent to update PNAB

It could be because you’re only changing the field value on the first document (before entering the loop). Move that one line into the loop, and you should be okay. Maybe. Until your users come after you with axes and pitchforks. You see, you’re changing the mailserver setting in ALL locations, which is great if and only if your new mailserver setting apply to all locations. If your users have, say, IMAP or POP3 locations for other mail accounts, you’ll blow their settings up real good.