Since all databases are required to have one view, and all design-elements basically are NotesDocuments, it's easy to rewrite the code to work without needing a "real document".
Function WebFilePath( db As NotesDatabase ) As String
Dim view As NotesView
Set view = db.Views(0)
Dim viewDoc As NotesDocument
Set viewDoc = db.GetDocumentByUNID( view.UniversalID )
WebFilePath = Join( Evaluate( |@WebDbName|, viewDoc ) )
If for some reason you're not working in a HTTP-environment, use this instead of @WebDbName:
@ReplaceSubstring( @DbName ; "\\" ; "/" )
Today, I had to make a multi-db search agent for web localhost compatible. When printing the path to the db, I had used NotesDatabase.FilePath. The problem with this is that it returns the filesystem path to the db when running locally. E.g. c:\lotus\notes\data\db.nsf
I could use NotesDatabase.ReplicaID, but I prefer somewhat readable URLs.
My solution was using evaluate @DbName (the path to the database), with a document from the db I was currently processing. Without the document as second argument, evaluate would return the path to the search database.
Function printPath(resultDoc As NotesDocument) As String
Dim dbpath As String
dbpath = Join( Evaluate( |
printPath= "/" + dbpath + "/0/" + resultDoc .UniversalID