Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
LotusScript And building URLs

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#LSURL or http://www.notesninjas.com/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.

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Beginning Java Web Services by Andre Tost, Henry Andre Bequet, Meeraj Kunnumpurath, Sean Rhody
Web services are no longer a nascent technology in the programming industry; every major software vendor is rolling out web services-related APIs and products. Today Java developers are successfully adopting web services as the latest technology in application development in order to enable...
See at: Amazon.co.uk | Amazon.com |