Subject: Lotusscript button to create a Location document in names.nsf
I think this will delete all connections and locations:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim nextdoc As NotesDocument
Dim destLocation As Variant
Dim allnabs As Variant
allnabs=session.addressbooks
Forall books In allnabs
'If The NAB Is Private, Than It Should Be Your Personal NAB
If books.isprivateaddressbook Then
'Verify if The NAB is Open, If Not, Open it
If Not(Books.isopen) Then
Call Books.open("",books.filename)
End If
Set db = Books
Set view = db.GetView("Connections")
Set doc = view.GetFirstDocument
'Delete all connection documents
While Not doc Is Nothing
Set nextdoc=view.GetNextDocument(doc)
Call doc.Remove(True)
Set doc=nextdoc
Wend
Set view = db.GetView("Locations")
Set doc = view.GetFirstDocument
'Delete all location documents
While Not doc Is Nothing
Set nextdoc=view.GetNextDocument(doc)
Call doc.Remove(True)
Set doc=nextdoc
Wend
End If
End Forall
End Sub
Then this will build a new location document, make sure you fill in the code with all the fields you want to set:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim doc As NotesUIDocument
'Create location document
Call workspace.ComposeDocument( “”, “names.nsf”, “Location” )
Set doc = workspace.Currentdocument
Call doc.FieldSetText(“LocationType”, “Local Area Network”)
Call doc.FieldSetText(“Name”, “Name of Location”)
Call doc.FieldSetText(“ImailAddress”, “yourName@yourDomain.com”)
Set the rest of the fields you want to set in here before saving and closing the doc
Call doc.Save
Call doc.Close
End Sub
I use something similar to this and just email the button to whoever I need to click on it.