< Back

Document Subject: LotusScript And building URLs
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#LSURL or http://A555F9/nn.nsf/ByAlias/LSURL

How to build a URL to a document in a web agent.




Lots of methods for this.

if urldoc is the document you want to create a url for:

 

dbpath = db.filepath
print  =" http://"; & s.internethostname & "." & s.internetdomainname & "/" &  dbpath & "/($All)/" & urldoc.universalid

Doesn't work too well, as the results are strange and inconsistent.

 

I prefer this method:

 Dim doc As notesdocument
Set doc = s.documentcontext
Print  doc.server_name(0)  & "/" & db.filepath & "/($All)/"+urldoc.universalid

 

 

Ok here is some code for grabbing the fully qualified internet host name form the server document.

It assumes db is already created and is on the same server.

 'get full servername
Dim nab As notesdatabase
Set nab= New NotesDatabase(db.Server,"names.nsf")
Dim nabview As notesview
Set nabview=nab.GetView("($ServersLookup)")
Dim snn As New notesname(db.Server)
If nabview Is Nothing Then  
 srver="http://"; & snn.Common
Else
 Dim sdoc As notesdocument
 Set sdoc = nabview.GetDocumentbykey(snn.Abbreviated,True)  
 If sdoc Is Nothing Then
  srver="http://"; & snn.Common
 Else
  srver="http://"; & sdoc.SMTPFullHostDomain(0)
 End If
End If

 url= srver  & "/" & db.filepath & "/($All)/"+doc.universalid )

 

NB if the server is https the server will convert http to https automatically.

If you use a windows box the slashes in the url will be backwards but firefox and ie can spot that.