I'm writing an agent which sends mails to a group of persons when new
documents have been created. These mails should contain HTTP links
to the newly created document.
For a given NotesDocument (session.DocumentContext), how do I get an
URL which allows the user to simply click on the link to be taken
to this document through a web browser?
Thanks a lot,
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (en)
Homepage: http://www.iso-top.biz | Jabber: ask...@a-message.de
iso-top.biz - Die günstige Art an Linux Distributionen zu kommen
- Ken
Hmm, from where do I get the contents of all these variables?
Especially, what's the content of dbname?
servername = doc.ParentDatabase.Server
viewname = "some_view"
key = "NT" & Right("00000000" & doc.NoteID, 8)
But "dbname"? First I thought I might use NotesDatabase.FilePath.
However, for local replicas, it returns the local path, eg.
C:\Lotus\Notes\Data\MyOwn\my_db.nsf. When I want to access it with a
browser, the URL is "http://localhost/MyOwn/my_db.nsf". But when I
replicate it to a server to "Projects\ASkwar\Dev0019.nsf", the URL would
be "http://server/Projects/ASkwar/my_db.nsf" and FilePath would be
"Projects\ASkwar\Dev0019.nsf".
Then I considered using db.HttpURL; however since this is supposed to be
code from an agent, it's run frow within Notes and thus HttpURL would be
empty. Further, the code has to run on a 5.0.11 server and there
HttpURL is only supported in COM (according to the manual).
You need to get aquatinted with LotusScript Classes. Its in the Designer
Help.
- Ken
Hm? In docurl, you use dbname$, thus you've used it as string. Here
you set dbname to be a NotesDatabase? I don't get it. I've just tried
what you've written, and when I cannot compile this script:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Messagebox "dbname: " & db
End Sub
Designer complains about a type mismatch in line 3 (the one with the
Messagebox statement).
> You need to get aquatinted with LotusScript Classes. Its in the Designer
> Help.
Thanks, I'm "aquatinted" ;) And yes, I've read the Designer Help but
did not find anything at all.
Would be fantastic, if you could help me once more! ;)
Examples: FileName property
1. This script gets the file name of the database cbanner.nsf. The property
returns "cbanner.nsf."
Dim db As New NotesDatabase( "Sofia", "cbanner.nsf" )
Dim file As String
file = db.FileName
2. This script gets the file name of the database cs_doc.nsf. The property
returns "cs_doc.nsf."
Dim db As New NotesDatabase( "Sofia", "cserv\cs_doc.nsf" )
Dim file As String
file = db.FileName
Yes, I've read the example for the FileName property. But that's still
not what I need.
Let me explain:
I'm looking for a way to get path to the database on the server on which
the database is running. This data should be used to construct an URL.
Further, it should work no matter where the database is located; IOW:
it should work when the database is on the server and when it's a local
replica.
So, if the database is located on the "server" at
"Projects\ASkwar\Dev0001.nsf", I'd like to get
"Projects/ASkwar/Dev0001.nsf". When it's a local replica at
"C:\Lotus\Notes\Data\Dev\my_db.nsf", I'd like to get "Dev/my_db.nsf" as
"Dev" is the first directory under the Notes Data directory.
NotesDatabase.FilePath comes close to what I'm after - but when the
database is a local replica, FilePath cannot be used.
Basically, something like @WebDbName would be great - in Lotus Script
and for Domino R5.
Ah, I think I found something:
@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName; -1);
"\\"; "/"); " "; "%20")
This returns just what I need. In both cases.
You could also use CGI variables Path_Info, Server_Name if the agent is
running in the web context.
Search for "Table of CGI variables" in the Designer Help for more
information.
- Ken
Yep, so do I ;)
> You could also use CGI variables Path_Info, Server_Name if the agent is
> running in the web context.
No, sadly (?) it's not running in the web context. It's activated when
documents have been created or modified. But I'll have a look at the
table. Thanks for this hint and all your help!
In thie example below, pdoc points to my Profile document. And tmpRich is a
NotesRichTextItem which becomes part of the e-mail body.
Set pdoc = db.GetProfileDocument("DatabaseProfile" )
This is in a loop as I attach all the items for one person to the same mail.
Call tmprich.appendtext("Link to this task ---> ")
Call tmprich.appendtext(pdoc.dbURL(0) + "/All/" + scheddoc.UniversalID +
"?OpenDocument" )
Call tmprich.addnewline(2)
Once the loop is complete I create the mail, and send it.
Set rtitem = New notesrichtextitem(maildoc, "Body")
Call rtitem.AppendText("The following ALIGN Tasks are OUTSTANDING and
require your attention")
Call rtitem.addnewline(2)
Call rtitem.Appendrtitem(tmprich)
Call maildoc.send (False)
Limitations : this only works for static databases. If your admin people
are always moving databases around or you have replication happening then
you need to think of some other way of storing the
http://www.serverName.com/myFolder/myDatabase.nsf/ information.
"Alexander Skwar" <usenet-posti...@spamgourmet.com> wrote in
message news:b1mjpj$14h3b4$1...@ID-13495.news.dfncis.de...