Examples: Resolve method

  1. This Visual Basic sub resolves a database URL showing various ways to construct the URL.
    Private Sub Command1_Click()
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim target As NotesDatabase
    Dim theURL As String
    s.Initialize
    Set db = s.GetDatabase("", "Document examples 2.nsf")
    
    Rem Construct URL using NotesURL
    theURL = db.NotesURL
    MsgBox theURL, , "NotesURL"
    Set target = s.Resolve(theURL)
    MsgBox target.Title, , "Target title"
    
    Rem Construct URL using FileName
    theURL = "notes:///" + db.FileName + "?OpenDatabase"
    MsgBox theURL, , "FileName"
    Set target = s.Resolve(theURL)
    MsgBox target.Title, , "Target title"
    
    Rem Construct URL using ReplicaID
    theURL = "notes:///" + db.ReplicaID + "?OpenDatabase"
    MsgBox theURL, , "ReplicaID"
    Set target = s.Resolve(theURL)
    MsgBox target.Title, , "Target title"
    
    Rem Construct URL using constant database name
    theURL = "notes:///Document examples 2?OpenDatabase"
    Rem Also OK: "notes:///Document examples 2.nsf?OpenDatabase"
    Rem Also OK: "notes:///Document+examples+2?OpenDatabase"
    Rem Also OK: "notes:///Document+examples+2.nsf?OpenDatabase"
    MsgBox theURL, , "Constant database name"
    Set target = s.Resolve(theURL)
    MsgBox target.Title, , "Target title"
    
    Rem Construct URL using constant replica ID
    theURL = "notes:///8525690D006AC34D?OpenDatabase"
    Rem Also OK: "notes:///__8525690D006AC34D.nsf?OpenDatabase"
    MsgBox theURL, , "Constant replica ID"
    Set target = s.Resolve(theURL)
    MsgBox target.Title, , "Target title"
    
    End Sub
  2. This Visual Basic sub resolves the URL for a view.
    Private Sub Command2_Click()
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim target As NotesView
    Dim theURL As String
    s.Initialize
    Set db = s.GetDatabase("", "Document examples 2.nsf")
    theURL = "notes:///Document examples 2/Main View?OpenView"
    MsgBox theURL, , "Constant database and view names"
    Set target = s.Resolve(theURL)
    MsgBox target.Name, , "Target name"
    End Sub
  3. This LotusScript® agent resolves the URL for a view.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim target As NotesView
      Dim theURL As String
      Set db = session.GetDatabase("", "Document examples 2.nsf")
      theURL = "notes:///Document examples 2/Main View?OpenView"
      Messagebox theURL, , "Constant database and view names"
      Set target = session.Resolve(theURL)
      Messagebox target.Name, , "Target name"
    End Sub