Manage Learn to apply best practices and optimize your operations.

Setting EnabledPorts Field

The requirement I was presented was to send a button to mobile users having a new location document created on their laptops with a new name and change some field values. Fairly simple except for the ports. We wanted to make sure TCPIP was enabled.

In this example we only wanted TCPIP to be enabled on the location document. We also knew all laptops had this port enabled through File-Tools-User Preferences. This is the entire code for the button however the key is how we dealt with the ports.

Click(Source As Button)
     Dim w As New NotesUIWorkspace     
     Dim s As New NotesSession
     Dim db As New NotesDatabase( "", "names.nsf" ) 'local copy of names.nsf
     Dim view As NotesView
     Dim doc As NotesDocument   
     Dim chkdoc As NotesDocument   
     Dim uidoc As NotesUIDocument
     Dim tmp As Variant
     Dim item As NotesItem
     
     tmp = Evaluate("@Trim(@GetPortsList([Enabled]))",doc) 'get enabled
 ports (enabled on laptop not from location document)
     Set view = db.GetView( "Locations" ) 
     
     Set chkdoc = view.GetDocumentByKey( "Dial MGR (Network)" )
     Set doc = view.GetDocumentByKey( "Office" )
     Set uidoc = w.CurrentDocument
     
     If Not chkdoc Is Nothing Then 'make sure button hadn't already been pressed
          Messagebox "Location Documents Already Updated. Thank you." 
          Exit Sub
     End If           
     
     If doc Is Nothing Then 'if an office document doesn't exist Notes
 Administrator must be notified.
          Messagebox "Button Failure:  You do not have an Office Location
 Document.  An email is being sent to the Notes Administrator requesting their
 assistance.  Thank you."          
          Dim maildb As NotesDatabase
          Dim maildoc As NotesDocument
          Set maildb = s.CurrentDatabase
          Set maildoc = New NotesDocument( maildb )
          maildoc.Form = "Memo"
          maildoc.SendTo = "Notes Administrator"
          maildoc.Subject = "Button Failure Notification:   User does not have
 Office Location Document"
          Call maildoc.Send( False )
          Exit Sub
     Else
          Call doc.CopyToDatabase(db) 'make copy office location document
          doc.Name = "Dial MGR (Network)" 'set fields
          doc.MailType = "Local"
          doc.DisabledPorts = "" 'disable all ports
          Set item = doc.GetFirstItem( "DisabledPorts" )
          Forall x In tmp 'loop through each port enabled in File-Tools-User 
Preferences
               If x <> "TCPIP" Then
                    Call item.AppendToTextList( x ) 'if the enabled port is not 
TCPIP, then add it to the list of disabled ports on this location document
               End If
          End Forall
          Call doc.Save( True, True )
     End If
     Messagebox "Location Documents Updated. Thank you." 
End Sub

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close