例: Resolve method

  1. 次の Visual Basic のサブルーチンは、URL を構成するさまざまな方法を示すデータベース 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. 次の Visual Basic のサブルーチンは、ビューの URL を解析します。
    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. 次の LotusScript® のエージェントは、ビューの URL を解析します。
    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