1

我有一些想导入 Access 或 SQL 的 Lotus Notes“数据库”。

我想我已经完成了大部分步骤(安装 NotesSQL ODBC 驱动程序,设置与 Lotus DB 的 ODBC 连接,将数据导入 Access),但我无法弄清楚如何处理所有文档,例如:Word 文件、PDF 文档, 在 Lotus DB 中的 Excel 工作簿。

Lotus Notes DB 充满了它们。导入后,我确实注意到 Access 中有一个名为“文档”的表,但我不知道如何处理它。我在 Lotus DB 中看到每个文档的行/记录,但它不像 SQL,其中有一个用于实际文件数据的列。

请让我知道如何实际使用从 Lotus DB 中提取的文档。

4

1 回答 1

2

最好的办法是从数据库中提取文档并将它们存储在文件共享中。这将为您提供最大的灵活性。要保留与原始 Notes 文档的关联,您可能希望将它们与文件名一起导出或导出到文件夹名称中包含 Access 中关联记录的 ID 的文件夹中。或者至少确保记录包含文档的路径。

我不相信您可以通过 NotesSQL 驱动程序提取附件。

这是一个示例脚本,您可以将其放入代理中以从数据库中提取附件:(来自http://www.notes411.com/dominosource/tips.nsf/0/4F1FF33C52F08D76802570C2003A2FD6!opendocument

Sub Initialize 
      Dim session As New NotesSession 
      Dim db As NotesDatabase 
      Dim collection As NotesDocumentCollection 
      Dim doc As NotesDocument 
      Set db = session.CurrentDatabase 
      Set collection = db.UnprocessedDocuments 
      Set doc = collection.GetFirstDocument() 
      While Not(doc Is Nothing) 
            Call extractMyAttachment( doc ) 
            Set doc = collection.GetNextDocument(doc) 
      Wend 
End Sub 

Function extractMyAttachment (doc) 
      Dim emb As Variant 
      Dim nid As String 

      nid = doc.NoteID 

      Dim rtitem As Variant 

      Set rtitem = doc.GetFirstItem( "Body" ) 

      Dim pathName As String, fileName As String, mydir As String, 
newfilename As String 
      mydir = "Coda" 
      pathName$ = "P:\" & mydir 

      fileName$ = Dir$(pathName$, 16) 

      Dim boxType As Long, answer As Integer 
      boxType& = 36 

      If fileName$ = "" Then 
            answer% = Messagebox("Directory "& pathName$ &" does not exist, 
would you like to create it ?", boxType&, "Create" & mydir & " on P:\ ?") 
            If answer% = 6 Then 
                  Mkdir pathname$ 

                  fileName$ = Dir$(pathName$, 16) 

                  If filename$ <> "" Then 
                        If ( rtitem.Type = RICHTEXT ) Then 

                              Forall o In rtitem.EmbeddedObjects 
                                    If ( o.Type = EMBED_ATTACHMENT ) Then 
                                          newfilename$ = pathname$ & "\" & 
o.source 
                                          Call o.ExtractFile (newfilename$ 
) 
                                    End If 
                              End Forall 

                        End If 
                  End If 
            End If 

      Else 
            If ( rtitem.Type = RICHTEXT ) Then 

                  Forall o In rtitem.EmbeddedObjects 
                        If ( o.Type = EMBED_ATTACHMENT ) Then 
                              newfilename$ = pathname$ & "\" & o.source 
                              fileName$ = Dir$(NewFileName$, 0) 
                              If fileName$ <> "" Then 
                                    answer% = Messagebox("File "& 
NewFileName$ &" already exists, would you like to overwirite it ?", 
boxType&, "Overwrite" & NewFileName$ & " ?") 
                                    If answer% = 6 Then 
                                          Call o.ExtractFile (newfilename$ 
) 
                                    End If 
                              Else 
                                    Call o.ExtractFile (newfilename$ ) 
                              End If 

                        End If 
                  End Forall 

            End If 
      End If 
End Sub 
于 2010-09-21T15:26:10.623 回答