gpt4 book ai didi

lotus-notes - Lotus Domino 8.5 数据库条目计数

转载 作者:行者123 更新时间:2023-12-04 06:52:09 25 4
gpt4 key购买 nike

我在 Domino 服务器(8.5 版)上有许多数据库,我需要找到以下数据库的数量:

  • 每个 NSF 的文档总数
  • 每个 NSF 的“所有文档” View 中的文档数量

  • 有没有什么简单的方法可以让 Domino Server 8.5 显示这个?

    非常感谢
    克里斯

    最佳答案

    您可以通过在域的其中一台服务器上启用域目录任务来获取每个 NSF 的文档数。这将创建一个域目录数据库 (catalog.nsf),其中包含域中所有数据库的信息。然后,您可以在该数据库中创建自定义 View ,以按文档总数等组织数据库。

    不幸的是,编目过程不会跟踪每个 View 中有多少文档。此外,无法保证每个数据库甚至都有一个“所有文档” View 。该 View 是许多数据库设计模板(如邮件或讨论)的一部分,但它实际上只是一个设计元素,而不是每个笔记数据库的基础。

    下面是一些您可以运行的代码,以在给定的服务器上为您获取该信息。注意,这段代码很慢。

    Sub CountDocuments()

    'Handle database not open error
    On Error Goto ProcessError
    On Error 4060 Goto ProcessNotOpenError
    On Error 4063 Goto ProcessNotOpenError
    On Error 4185 Goto ProcessNotOpenError

    'Constants
    Const SERVERNAME = "SERVER/DOMAIN"
    Const FILENAME = "C:\database_entry_counts.csv"

    'Initialize Objects
    Dim s As New Notessession
    Dim db As Notesdatabase
    Dim dbDirectory As NotesDbDirectory
    Dim docCollection As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim strRow As String
    Dim numDocs As Long, numAllDocs As Long
    Dim viewAllDocs As NotesView
    Dim vecAllDocs As NotesViewEntryCollection
    Dim ve As NotesViewEntry
    Dim docCount As Long

    'Get Database Directory
    Set dbDirectory = s.GetDbDirectory(SERVERNAME)
    Set db = dbDirectory.GetFirstDatabase(DATABASE)
    flag = db.Open( "", "" )
    While flag = False 'Get next database if first can't be opened
    Set db = dbDirectory.GetNextDatabase
    flag = db.Open( "", "" )
    Wend

    'Open output file
    Set stream = s.CreateStream
    If Not stream.Open(FILENAME, "ASCII") Then
    Messagebox FILENAME,, "Open failed"
    Exit Sub
    End If
    If stream.Bytes <> 0 Then
    Messagebox FILENAME,, "File already exists and has content"
    Exit Sub
    End If

    'Output headers
    Call stream.WriteText(|"Database Name","Total Documents","Count of All Documents"|, EOL_CRLF)


    'Main Loop
    While Not (db Is Nothing)

    Print "Working on: " & db.Title

    docCount = 0
    strRow = ""

    'Get number of documents in database (easy)
    numDocs = db.AllDocuments.Count

    'Get number of documents in view (annoyingly difficult)
    Set viewAllDocs = db.GetView("($All)")
    If Not (viewAllDocs Is Nothing) Then
    Set vecAllDocs = viewAllDocs.AllEntries
    Set ve = vecAllDocs.GetFirstEntry
    While Not (ve Is Nothing)
    If ve.IsDocument Then docCount = docCount + 1
    Set ve = vecAllDocs.GetNextEntry(ve)
    Wend
    Else
    docCount = 0
    End If

    'Output values to our comma delimited list
    strRow = |"| & db.Title & |","| & numDocs & |","| & docCount & |"|
    Call stream.WriteText(strRow, EOL_CRLF)

    'Get next database that can be opened
    Set db = dbDirectory.GetNextDatabase
    If Not (db Is Nothing) Then flag = db.Open( "", "" )
    While flag = False
    Set db = dbDirectory.GetNextDatabase
    If Not (db Is Nothing) Then flag = db.Open( "", "" )
    Wend

    Wend

    'Close file
    Call stream.Close

    Exit Sub

    ProcessNotOpenError:

    Resume Next

    ProcessError:

    Messagebox "Error " & Err() & ": " & Error()
    If Not stream Is Nothing Then
    stream.Close
    End If

    Exit Sub

    End Sub

    这将输出一个 CSV 文件,其中包含数据库名称和您要查找的计数,前提是您使用有权访问服务器上所有数据库的帐户运行此文件。

    关于lotus-notes - Lotus Domino 8.5 数据库条目计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2956575/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com