我要访问和使用共享文件。我考虑了以下方法: 1.将附件存储在Notes文档中 2.将附件存储在数据库配置文件中
但在两种情况下,我都需要添加额外的UI设计元素(窗体,视图...) 因此,最简单的维护方法-使用db资源(图像或文件)。 我需要创建LotusSrcit操作,该操作将从db Resources中访问文件并将其附加到新的NotesDocument中,该文件将作为电子邮件发送。
答案 0 :(得分:0)
您可以使用NotesNoteCollection类访问文件或图像资源。但是,由于Notes以其自己的内部格式存储附件或图像,因此,即使有可能,也不容易使用纯LotusScript访问这些附件。
我发现一个有用的解决方法是将文件附加到Applet资源,可以使用纯LotusScript访问该文件;参见下面的示例代码。
Dim sn As New NotesSession()
Dim db as NotesDatabase
Dim nc As NotesNoteCollection
Dim designNote As NotesDocument
Dim eo As NotesEmbeddedObject
Dim noteID$, myFileName$
myFileName = "foobar.txt"
Set db = sn.CurrentDatabase
Set nc = db.CreateNoteCollection(False)
nc.SelectJavaResources = True 'select all Applet resources
nc.SelectionFormula = {$TITLE="} + myFileName + {"} 'assuming the Applet resource has the same name as the file
Call nc.BuildCollection()
noteID = nc.GetFirstNoteID()
Do Until Len(noteID) = 0
Set designNote = db.GetDocumentByID(noteID)
Set eo = designNote.GetAttachment(myFileName)
If Not (eo Is Nothing) Then
'----- your code goes here -----
Exit Do
End If
noteID = nc.GetNextNoteID(noteID)
Loop
我在这里做两个假设: