如何检索“记录活动” Lotus Notes 数据库的标志?

发布于 2024-12-09 01:37:56 字数 158 浏览 0 评论 0原文

“Lotus Notes 数据库的记录活动”标志

我想检索 Lotus Notes 数据库的“记录活动”标志,如屏幕截图所示(请参阅左下角的复选框)。我怎样才能通过 API 做到这一点?

"Record activity" flag of Lotus Notes database

I would like to retrieve the "Record activity" flag of Lotus Notes database, shown in the screenshot (see the checkbox in the bottom-left corner). How can I do that through API?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝影如岚 2024-12-16 01:37:56

更新:
仅通过 LotusScript 无法做到这一点,但也许您可以通过 Lotus Notes C API 获取此信息。

NSFDbGetUserActivity 方法将返回用户活动信息(显示在该对话框中),或者如果没有摘要信息,它将返回 ERR_SPECIAL_ID。这不是确定是否检查记录活动标志的精确方法,但您可以从该方法的结果推断标志的状态。

当然,仍然有可能标记已被检查,但尚未记录任何活动,或者相反,标记检查,但活动先前已记录在数据库中。

另一种解决方案可能是以编程方式执行通常会记录在用户活动中的操作。然后,您可以检查该活动是否确实被记录,然后您就可以知道该标志是否处于活动状态。如果您指定一个特殊的 Notes 用户来运行此代码,则可以更轻松地从活动列表中挑选出该用户,从而避免由某些正常的最终用户活动引起的误报。

下面的代码向您展示了如何通过 C API 获取用户活动信息,取自本教程页面上的示例 #3: http://www.triplewhitefox.com/tech-calling-c-api-from-lotusscript

(声明)

'Structures used by Notes C API
Type TIMEDATE
   Innards(1) As Long 'DWORD
End Type

Const MAXALPHATIMEDATE = 80

Type DBACTIVITY
   First As TIMEDATE      'TIMEDATE /* Beginning of reporting period */
   Last As TIMEDATE        'TIMEDATE /* End of reporting period */
   Uses As Long            'DWORD /* # of uses in reporting period */
   Reads As Long           'DWORD /* # of reads in reporting period */
   Writes As Long          'DWORD /* # of writes in reporting period */
   PrevDayUses As Long     'DWORD /* # of uses in previous 24 hours */
   PrevDayReads As Long    'DWORD /* # of reads in previous 24 hours */
   PrevDayWrites As Long   'DWORD /* # of writes in previous 24 hours */
   PrevWeekUses As Long    'DWORD /* # of uses in previous week */
   PrevWeekReads As Long   'DWORD /* # of reads in previous week */
   PrevWeekWrites As Long  'DWORD /* # of writes in previous week */
   PrevMonthUses As Long   'DWORD /* # of uses in previous month */
   PrevMonthReads As Long  'DWORD /* # of reads in previous month */
   PrevMonthWrites As Long 'DWORD /* # of writes in previous month */
End Type

'STATUS LNPUBLIC NSFDbGetUserActivity(DBHANDLE hDB, DWORD Flags, DBACTIVITY far *retDbActivity, HANDLE far *rethUserInfo, WORD far *retUserCount);
Declare Function NSFDbGetUserActivity Lib "nnotes.dll" (Byval hDB As Long, Byval Flags As Long, retDbActivity As DBACTIVITY, rethUserInfo As Long, retUserCount As Integer) As Integer

'STATUS LNPUBLIC NSFDbClose( DBHANDLE hDB);
Declare Function NSFDbClose Lib "nnotes.dll" (Byval hDB As Long) As Integer

'STATUS LNPUBLIC NSFDbOpen(char far *PathName, DBHANDLE far *rethDB);
Declare Function NSFDbOpen Lib "nnotes.dll" (Byval filepath As String, DB As Long) As Integer

'STATUS LNPUBLIC ConvertTIMEDATEToText(const void far *IntlFormat, const TFMT far *TextFormat, const TIMEDATE far *InputTime, char far *retTextBuffer, WORD TextBufferLength, WORD far *retTextLength);
Declare Function ConvertTIMEDATEToText Lib "nnotes.dll" (Byval IntlFormat As Integer, Byval TextFormat As Integer, InputTime As TIMEDATE, Byval retTextBuffer As String, Byval TextBufferLength As Integer, retTextLength As Integer) As Integer

初始化

Sub Initialize
   Dim ReturnCodel As Long
   Dim hDBl As Long
   Dim retDbActivity As DBACTIVITY
   Dim rethUserInfo As Long
   Dim retUserCount As Integer
   Dim Flags As Long

   Dim retTextBuffer As String
   Dim retTextLength As Integer
   Dim BufferSize As Integer

   Dim session As New NotesSession

   'Open the database
   ReturnCodel = NSFDbOpen(session.CurrentDatabase.FilePath, hDBl)
   If ReturnCodel <> 0 Then
      Error 9999, "An error occurred calling the API function " + _
         "NSFDbOpen." & Chr$(10) & "The return code was " & + _
         Trim$(Str$(ReturnCodel)) & "."
      Exit Sub
   End If

   Flags = 0
   ReturnCodel = NSFDbGetUserActivity(hDBl, Flags, retDbActivity, rethUserInfo, retUserCount)
   If ReturnCodel <> 0 Then
      Error 9999, "An error occurred calling the API function " + _          "NSFDbGetUserActivity." & Chr$(10) & "The return code was " & + _
         Trim$(Str$(ReturnCodel)) & "."
      Call NSFDbClose(hDBl)
      Exit Sub
   End If

   retTextBuffer = String$(MAXALPHATIMEDATE + 1,0)
   ReturnCodel = ConvertTIMEDATEToText(0, 0, retDBActivity.First, retTextBuffer, MAXALPHATIMEDATE, retTextLength)
   Print "First access = " + Left(retTextBuffer, retTextLength)

   retTextBuffer = String$(MAXALPHATIMEDATE + 1,0)
   ReturnCodel = ConvertTIMEDATEToText(0, 0, retDBActivity.Last, retTextBuffer, MAXALPHATIMEDATE, retTextLength)
   Print "Last access = " + Left(retTextBuffer, retTextLength)

   Print "Uses = " + Cstr(retDBActivity.Uses)
   Print "Reads = " + Cstr(retDBActivity.Reads)
   Print "Writes =" + Cstr(retDBActivity.Writes)

   'Close the database
   ReturnCodel = NSFDbClose(hDBl)
End Sub

UPDATE:
No way to do so via LotusScript alone, but perhaps you can get this information via the Lotus Notes C API.

The NSFDbGetUserActivity method will either return the user activity information (shown in that dialog) or it will return ERR_SPECIAL_ID if there is no summary information. This is not a precise way to determine whether the record activity flag is checked, but you could infer the state of the flag from the result of the method.

Of course, there's still the chance the flag is checked, but no activity has been recorded yet, or conversely the flag is not checked but activity was previously recorded in the database.

Another solution may be to programmatically perform an action that would normally get recorded in the User Activity. You could then check to see if that activity is in fact recorded, and you'd then know whether that flag was active or not. If you dedicate a special Notes user to run this code, it would be easier to pick out that user from the list of activities avoiding a false positive caused by some normal end-user activity.

The code below shows you how to get at the User Activity information via the C API, taken from example #3 on this tutorial page: http://www.triplewhitefox.com/tech-calling-c-api-from-lotusscript

(declarations)

'Structures used by Notes C API
Type TIMEDATE
   Innards(1) As Long 'DWORD
End Type

Const MAXALPHATIMEDATE = 80

Type DBACTIVITY
   First As TIMEDATE      'TIMEDATE /* Beginning of reporting period */
   Last As TIMEDATE        'TIMEDATE /* End of reporting period */
   Uses As Long            'DWORD /* # of uses in reporting period */
   Reads As Long           'DWORD /* # of reads in reporting period */
   Writes As Long          'DWORD /* # of writes in reporting period */
   PrevDayUses As Long     'DWORD /* # of uses in previous 24 hours */
   PrevDayReads As Long    'DWORD /* # of reads in previous 24 hours */
   PrevDayWrites As Long   'DWORD /* # of writes in previous 24 hours */
   PrevWeekUses As Long    'DWORD /* # of uses in previous week */
   PrevWeekReads As Long   'DWORD /* # of reads in previous week */
   PrevWeekWrites As Long  'DWORD /* # of writes in previous week */
   PrevMonthUses As Long   'DWORD /* # of uses in previous month */
   PrevMonthReads As Long  'DWORD /* # of reads in previous month */
   PrevMonthWrites As Long 'DWORD /* # of writes in previous month */
End Type

'STATUS LNPUBLIC NSFDbGetUserActivity(DBHANDLE hDB, DWORD Flags, DBACTIVITY far *retDbActivity, HANDLE far *rethUserInfo, WORD far *retUserCount);
Declare Function NSFDbGetUserActivity Lib "nnotes.dll" (Byval hDB As Long, Byval Flags As Long, retDbActivity As DBACTIVITY, rethUserInfo As Long, retUserCount As Integer) As Integer

'STATUS LNPUBLIC NSFDbClose( DBHANDLE hDB);
Declare Function NSFDbClose Lib "nnotes.dll" (Byval hDB As Long) As Integer

'STATUS LNPUBLIC NSFDbOpen(char far *PathName, DBHANDLE far *rethDB);
Declare Function NSFDbOpen Lib "nnotes.dll" (Byval filepath As String, DB As Long) As Integer

'STATUS LNPUBLIC ConvertTIMEDATEToText(const void far *IntlFormat, const TFMT far *TextFormat, const TIMEDATE far *InputTime, char far *retTextBuffer, WORD TextBufferLength, WORD far *retTextLength);
Declare Function ConvertTIMEDATEToText Lib "nnotes.dll" (Byval IntlFormat As Integer, Byval TextFormat As Integer, InputTime As TIMEDATE, Byval retTextBuffer As String, Byval TextBufferLength As Integer, retTextLength As Integer) As Integer

Initialize

Sub Initialize
   Dim ReturnCodel As Long
   Dim hDBl As Long
   Dim retDbActivity As DBACTIVITY
   Dim rethUserInfo As Long
   Dim retUserCount As Integer
   Dim Flags As Long

   Dim retTextBuffer As String
   Dim retTextLength As Integer
   Dim BufferSize As Integer

   Dim session As New NotesSession

   'Open the database
   ReturnCodel = NSFDbOpen(session.CurrentDatabase.FilePath, hDBl)
   If ReturnCodel <> 0 Then
      Error 9999, "An error occurred calling the API function " + _
         "NSFDbOpen." & Chr$(10) & "The return code was " & + _
         Trim$(Str$(ReturnCodel)) & "."
      Exit Sub
   End If

   Flags = 0
   ReturnCodel = NSFDbGetUserActivity(hDBl, Flags, retDbActivity, rethUserInfo, retUserCount)
   If ReturnCodel <> 0 Then
      Error 9999, "An error occurred calling the API function " + _          "NSFDbGetUserActivity." & Chr$(10) & "The return code was " & + _
         Trim$(Str$(ReturnCodel)) & "."
      Call NSFDbClose(hDBl)
      Exit Sub
   End If

   retTextBuffer = String$(MAXALPHATIMEDATE + 1,0)
   ReturnCodel = ConvertTIMEDATEToText(0, 0, retDBActivity.First, retTextBuffer, MAXALPHATIMEDATE, retTextLength)
   Print "First access = " + Left(retTextBuffer, retTextLength)

   retTextBuffer = String$(MAXALPHATIMEDATE + 1,0)
   ReturnCodel = ConvertTIMEDATEToText(0, 0, retDBActivity.Last, retTextBuffer, MAXALPHATIMEDATE, retTextLength)
   Print "Last access = " + Left(retTextBuffer, retTextLength)

   Print "Uses = " + Cstr(retDBActivity.Uses)
   Print "Reads = " + Cstr(retDBActivity.Reads)
   Print "Writes =" + Cstr(retDBActivity.Writes)

   'Close the database
   ReturnCodel = NSFDbClose(hDBl)
End Sub
始终不够 2024-12-16 01:37:56

AGECOM 提供免费的 NotesUser Activity 类 (CLASSUserActivity) 应用程序。他们完全审查并更新了最初由 Daniel Alvers 编写的课程。

Release 2x 中的改进包括:

  • 对原始代码进行了大量修复和增强。

  • 从 LotusScript 调用 Lotus C-API 代码时更正数据类型和内存对齐。

  • 在整个代码中实现错误处理。

  • 增强了用于收集和显示检索到的用户活动信息的示例代理。

  • 用于扫描所有或选定数据库中的用户活动的新选项。

  • 用于显示用户活动信息报告的新视图。

您可以从 AGECOM 网站下载更新:
http://www.agecom.com.au/useractivity

该应用程序是一个标准的 Lotus Notes 应用程序并且可以立即从 Lotus Notes 客户端运行。

There is a NotesUser Activity class (CLASSUserActivity) application freely available from AGECOM. They've completely reviewed and updated the class originally written by Daniel Alvers.

Improvements in Release 2x include:

  • Numerous fixes and enhancements to the original code.

  • Correction to data types and memory alignments when making calls to Lotus C-API code from LotusScript.

  • Implementation of error handling throughout the code.

  • Enhancement to sample agent for collection and displaying retrieved user activity information.

  • New options to scan user activity in all or selected databases.

  • New views to show reports of user activity information.

You can download the update from the AGECOM website at:
http://www.agecom.com.au/useractivity

The application is a standard Lotus Notes application and can be run immediately from the Lotus Notes client.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文