Need to update contacts in PNAB from server agent

I cannot figure out how to get a handle to the PNAB object from a server agent - actually I have been asked to create a button that will be emailed to users that when clicked will basically refresh all the documents in their PNAB. Is there another way to accomplish this, seamlessly?

Here’s my button script:

Sub Click(Source As Button)

Dim nses_Cur As NotesSession

Dim ndb_PNAB As NotesDatabase

Dim nvw_Contacts As NotesView

Dim ndoc_Contact As NotesDocument

Dim int_Open As Integer



Set ndb_PNAB = nses_Cur.GetDatabase( "Localhost", "C:\Program Files\notes\data\names.nsf" )

int_Open =  ndb_PNAB.Open("","")

Set nvw_Contacts = ndb_PNAB.GetView( "Contacts" )

Set ndoc_Contact = nvw_Contacts.GetFirstDocument

If ( ndoc_Contact Is Nothing ) Then

	Messagebox "Error - did not get contact doc"

	Exit Sub

End If



Do While Not ndoc_Contact Is Nothing

	Call ndoc_Contact.ComputeWithForm( False, False )

	Call ndoc_Contact.Save( True, False )

	Set ndoc_Contact = nvw_Contacts.GetNextDocument( ndoc_Contact )

Loop



Messagebox "Successfully updated all Contact docs in address book"

End Sub

Thanks!

Ginni

Subject: Need to update contacts in PNAB from server agent

Hi,

The first thing to understand is that in this scenario you are not running a
server agent. If you send this button to your users then the code will be
executing on their local Notes client.

You problem appears to be the use of “localhost”. This will try to open the
database on a server called “localhost”. You need to use “” to open a database
on the local workstation i.e.

Dim int_Open As Integer Set ndb_PNAB = nses_Cur.GetDatabase( “”, “C:\Program
Files\notes\data\names.nsf” )

Regards

Ethann Castell
font color=“#FF7700”>Caliton&nbspInnovations
www.caliton.com]