How to create connection document programmatically?

The below steps would be helpful to create Connection Document through button coded with Lotus Script.

You can send this button to users through mail and when clicked, it creates the new Connection Document in user's Local Address Book.

Note : Please check this in your test environment before deploy in production.

Steps :

Compose a New Mail

Create --> Hotspot Button

Label it with 'New Connection doc'

Select LotusScript

Paste the below code between Sub Click(Source As Button) and End Sub

Note : This is a sample code. You can customize the code as per the requirement.


Note : Please check this in your test environment before deploy in production.

Steps :

Compose a New Mail

Create --> Hotspot Button

Label it with 'New Connection doc'

Select LotusScript

Paste the below code between Sub Click(Source As Button) and End Sub

Note : This is a sample code. You can customize the code as per the requirement.

Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As New NotesDatabase("","names.nsf")
Dim uidoc As NotesUIDocument
Set uidoc= ws.composedocument("","names.nsf","Connection")
Call uidoc.fieldsettext("ConnectionType","0")
Call uidoc.refreshhideformulas
Call uidoc.FieldSetText("PortName","TCPIP")
Call uidoc.FieldSetText("LanPortName","TCPIP")
'The FieldSetText method is used here to set the values of other fields
Call uidoc.FieldSetText("ConnectionLocation","*")
Call uidoc.refreshhideformulas
'Replace TEST/ORG with your Server name.
Call uidoc.FieldSetText("Destination","TEST/ORG")
'Replace x.x.x.x with IP Address of the Server
Call uidoc.FieldSetText("OptionalNetworkAddress","x.x.x.x")
Call uidoc.FieldSetText("Source","*")
Call uidoc.refreshhideformulas
Call uidoc.Refresh
Call uidoc.Save
Call uidoc.Close
Messagebox "DONE"

Has any one tried this? Is this helpful?

Please do let me know if you have any queries on this..?

The problem with your code: It is frontend code and uses frontend classes... It will not run in an agent, it cannot be run automatically and it opens a Window for every Connection document you want to create (what might fail under certain circumstances). Therefor I would not use it that way.

I would only use NotesDocument- Class and "ReplaceItemValue".