I do Code - A Weblog by Finn Ladegaard Knudsen. About Code and things related to Code

’Added to File’ the missing NotesDocument Property

Finn L. Knudsen  14 November 2008 14:03:47
Copy of the code I posted on bleedyellow.com  2008.04.04

This function returns the date/time a NotesDocument has been added to the Notes database.
And if the document is added by the replicator it is different from 'Created'.

I have used it to find documents that once where delete but reappeared after a replication with an old replica of the database.



'This LotusScript function uses the Notes API to access the 'Added to File' property for a NotesDocument.
' Declarations
Type TIMEDATESTRUCTE
Innards(1) As Long

End Type
Declare Sub W32_NSFNoteGetInfo Lib "nnotes" Alias "NSFNoteGetInfo" (_
Byval note_handle As Long, _
Byval note_member As Integer, _
value_ptr As Any )
Declare Function W32_ConvertTIMEDATEToText Lib "nnotes.dll" Alias "ConvertTIMEDATEToText" (_
Byval nullFormat As Long, _
Byval textformat As Long, _
td As Any, _
Byval Buff As String, _
Byval maxlen As Integer, _
textLength As Integer) As Integer
%REM
*     Note structure member IDs for NSFNoteGet&SetInfo. */
#define    _NOTE_DB        0        /* IDs for NSFNoteGet&SetInfo */
#define    _NOTE_ID        1        /* (When adding new values, see the */
#define    _NOTE_OID        2        /*  table in NTINFO.C */
#define    _NOTE_CLASS        3
#define    _NOTE_MODIFIED    4
#define    _NOTE_PRIVILEGES    5    /* For pre-V3 compatibility. Should use $Readers item */
#define    _NOTE_FLAGS        7
#define    _NOTE_ACCESSED    8
#define _NOTE_PARENT_NOTEID 10    /* For response hierarchy */
#define _NOTE_RESPONSE_COUNT 11    /* For response hierarchy */
#define _NOTE_RESPONSES 12        /* For response hierarchy */
#define _NOTE_ADDED_TO_FILE 13    /* For AddedToFile time */
#define _NOTE_OBJSTORE_DB 14    /* DBHANDLE of object store used by linked items */
%END REM
' Functions
Function NotesDocumentAddedToFile( ndoc As NotesDocument) As Variant
Dim hNote As Long
Dim tds As TIMEDATESTRUCTE
Dim sDateTime As String*256
Dim iDate As Integer
Dim vDateTime As Variant

hNote = ndoc.Handle
Call W32_NSFNoteGetInfo( hNote, 13, tds )
Call W32_ConvertTIMEDATEToText (0,0,tds, sDateTime, 256, iDate%)
' convert to variant DateTime
vDateTime = Cdat( sDateTime)
NotesDocumentAddedToFile = vDateTime
End Function
Technorati Profile Add to Technorati Favorites