I am trying to create a Button that i can email to users to make a few changes in the local address book.
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