关闭

添加服务器链接

标签: 服务器buttonsessionstring
637人阅读 评论(0) 收藏 举报
分类:
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 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:85597次
    • 积分:1305
    • 等级:
    • 排名:千里之外
    • 原创:38篇
    • 转载:16篇
    • 译文:0篇
    • 评论:14条
    最新评论
    恋猪の明