Link to home
Start Free TrialLog in
Avatar of timkrampe1
timkrampe1

asked on

Lotus Notes Button to make changes to Location Documents

I am trying to create a Button that i can email to users to make a few changes in the local address book.

I am using Domino 6.5.5 and Notes Client 7.0.1

The button needs to change 2 things in any location document. It needs to change the "Domino Directory Server" on the "Servers" tab and the "Mail Addressing" on the "Mail" tab.

The code below makes the changes but the changes do not seem to go into effect until you manually open the location doc for editing, edit any field and then save. Any ideas/suggestions?


'Modifies directory server and mail addressing fields
'Sets all of the location documents

Sub Click(Source As Button)
Dim session As New notessession
Dim workspace As New NotesUIWorkspace
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc = uiw.currentdocument
Dim doc As notesdocument
Set doc = uidoc.document

'For The Current User in The Current Session, Get All The NABs

Forall books In session.addressbooks

'Check If The Current NAB is Private or Public
'If The NAB Is Private, Than It Should Be Your Personal NAB

If books.isprivateaddressbook And books.filename = "names.nsf" Then

'Verify if The NAB is Open, If Not, Open it

If Not(Books.isopen) Then
Call Books.open("",books.filename)

'Now Get All The Documents in The Location View

Set view = books.getview("Locations")
Set doc = view.getfirstdocument
While Not (doc Is Nothing)

'Modify Mail Addressing

Call doc.replaceitemvalue ("directoryserver","MAIL01/SRV/PDCO")
Call doc.replaceitemvalue ("mailaddressing","Local and Server")
Call doc.save (True,True)
Set doc = view.getnextdocument(doc)
Wend
End If
End If
End Forall
Call uidoc.send
End Sub
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

Try changing

Call doc.save (True,True)

to

Call doc.save (True,False)
Avatar of timkrampe1
timkrampe1

ASKER

That did not work either
ASKER CERTIFIED SOLUTION
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually i jumped the gun on this.  It worked on 2 machines, but no more after that.  their setups were identical before running this script.
Fixed it.  Removed the following Lines

Dim workspace As New NotesUIWorkspace
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc = uiw.currentdocument
Dim doc As notesdocument
Set doc = uidoc.document

Call uidoc.send

Restart notes and everything works.