添加服务器链接

Sub Click(Source As Button)
 On Error Goto ef
 Dim session As New NotesSession
 Dim dbNAB As NotesDatabase
 Dim dc As NotesDocumentCollection
 Dim doc As NotesDocument, docTemp As NotesDocument
 Dim strSearch As String
 
 Set dbNab = session.GetDatabase( "", "")
 
 Call dbNab.Open( "", "names.nsf" )
 
 strSearch = { ( form = "local" | form = "remote" ) & ( Destination = "TEST02.CN.ABB.COM/SRV/ABB" | Destination = "CN=TEST02.CN.ABB.COM//OU=SRV/O=ABB" ) }
 
 Set dc = dbNAB.Search( strSearch, Nothing, 0 )
 
 If dc.count > 0 Then
  Set doc = dc.getfirstdocument
  
  With doc
   .Destination = "TEST02.CN.ABB.COM/SRV/ABB"
   .LanPortName = "TCPIP"
   .PortName = "TCPIP"
   .OptionalNetworkAddress = "10.138.250.27"
   .PhoneNumber = "10.138.250.27"
   .Owner = session.username
   .documentaccess = "[NetModifier]"
   Call .computewithform( True, False )
   Call .save( True, True )
   Msgbox "Connection document has been updated"   
  End With
  Set doc = dc.GetNextdocument( doc )
  Do Until doc Is Nothing
   Set docTemp = doc
   Set doc = dc.GetNextdocument( doc )
   Call docTemp.remove( True ) 
  Loop
 Else
  Set doc = dbNab.CreateDocument  
  
  With doc
   .form = "local"
   .type = "Connection"
   .connectionLocation = "*"
   .connectionType = "0"
   .Source = "*"
   .Destination = "TEST02.CN.ABB.COM/SRV/ABB"
   .LanPortName = "TCPIP"
   .PortName = "TCPIP"
   .OptionalNetworkAddress = "10.138.250.27"
   .PhoneNumber = "10.138.250.27"
   .Owner = session.username
   .documentaccess = "[NetModifier]"
   Call .computewithform( True, True )
   Call .save( True, True )
  End With
  Msgbox "Connection document has been created"
 End If
 
 Exit Sub
ef:
 Msgbox "error is" & Error$ & "”;and in line " & Erl, 16, "Error"
 Exit Sub
 
End Sub 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值