跟踪谁正在读哪个文档

Description:  There have been times where you what to see who has been reading what documents in a database. This helps track if the right audiance is looking at your documents and what documents are being used and which ones are not beeing looked at.

There are 2 methods to accomplish this:
In the Terminate event of the database document, put the following script in. This script will do 2 things when a document is closed:

a) it will mail a notice to a log database that you have to create. This database you can create from a blank template and create one form called a "memo" with 3 fields: From, Subject & PostedDate. And

b) update a "who_read" field you add to the form.

Obviously you do not need both features, just 1 of them: either create a database log of who reads what documents or a reader field.

Code:

Dim session As New NotesSession 
Dim workspace As New NotesUIWorkspace 
Dim maildb As NotesDatabase
Dim maildoc As NotesDocument
Dim uidoc As NotesUIDocument 
Dim doc As NotesDocument
Dim item As NotesItem

Set uidoc = workspace.currentdocument
Set doc = uidoc.Document 

' Get the reader name and current date & time 
user = Evaluate("@Name([Abbreviate]; @UserName)")
dateread = Evaluate("@Now")
readstring = user(0)
readstringdate = dateread(0)
displayall = readstring & " : " & readstringdate

' Append the current reader and date to the WhoRead field 
Set item = doc.GetFirstItem( "WhoRead" ) 
Call item.AppendToTextList(displayall) 
Call doc.Save(False,True)

' Mail the data to the log database for easy searching 
mailsubject = uidoc.FieldGetText("Subject") 
Set maildb = session.currentdatabase
Set maildoc = New NotesDocument ( maildb )
maildoc.Form = "Memo"
maildoc.SendTo = "name of mail-in database"
maildoc.Subject = "Read America Wire Dcoument titled: " + mailsubject
Call maildoc.Send( False ) 
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容