Domino Code Fragment

Code Name*
LotusScript manipulation of Design notes
Date*
6/26/97
Source (or email address if you prefer)*
Bill Ernest
IP address:.3.15.190.144
Description*
Use API routines exposed in Notes client DLLs to do just about anything to Design notes or other Notes objects.
Type*
LotusScript
Categories*
Design Configuration
Implementation:
Modify constants
Required Client:
Server:
Limitations:
Works on Win95/98/NT as is, can be modified for UNIX. Does not work on Apple or OS/2.
Comments:
Paste this into a LotusScript button.

Note that you can use this to copy, rename, modify design elements. Useful for installation routines that add/remove design elements to existing databases.
Files/Graphics attachments (if applicable): Code:
Declare Sub OSPathNetConstruct Lib "nnotes.dll" (Byval portName As String, Byval ServerName As String, Byval FileName As String, Byval retPathName As String)
Declare Function NSFDbOpen Lib "nnotes.dll" (Byval PathName As String, dbHandle As Long) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" (Byval dbHandle) As Integer
Declare Function NIFFindDesignNote Lib "nnotes.dll" (Byval dbHandle As Long, Byval Name As String, Byval Class As Integer, retNoteID as Long) as integer

Const NOTE_CLASS_DOCUMENT =  &H0001
Const NOTE_CLASS_DATA = NOTE_CLASS_DOCUMENT
Const NOTE_CLASS_INFO = &H0002
Const NOTE_CLASS_FORM = &H0004
Const NOTE_CLASS_VIEW = &H0008
Const NOTE_CLASS_ICON = &H0010
Const NOTE_CLASS_DESIGN = &H0020
Const NOTE_CLASS_ACL = &H0040
Const NOTE_CLASS_HELP_INDEX = &H0080
Const NOTE_CLASS_HELP = &H0100
Const NOTE_CLASS_FILTER = &H0200   'This is an Agent, Macro
Const NOTE_CLASS_FIELD = &H0400
Const NOTE_CLASS_REPLFORMULA = &H0800
Const NOTE_CLASS_PRIVATE = &H1000

Const NOTE_CLASS_DEFAULT = &H8000
Const NOTE_CLASS_NOTIFYDELETION = NOTE_CLASS_DEFAULT
Const NOTE_CLASS_ALL = &H7FFF
Const NOTE_CLASS_ALLNONDATA = &H7FFE
Const NOTE_CLASS_NONE = &H0000


Sub Click(Source As Button)
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Set db = s.CurrentDatabase
    NoteID = GetDesignIDStr(db, "1. All Posts", NOTE_CLASS_VIEW)
    Messagebox("1. All Posts Note ID = " + NoteID)
    Set doc = db.GetDocumentByID(NoteID)
    u1 = doc.GetItemValue("$UpdatedBy")
    Messagebox("Last $UpdatedBy = " + u1(0))
End Sub


Function GetDesignIDStr(db As NotesDatabase, DesignName As String, DesignType As Integer) As String
     Dim dbHandle As Long
    Dim status As Integer
    Dim Path As String * 256

     Dim NoteID as Long
   
    ' Set handles to NULL (to help in error handling)
    dbHandle = 0
    GetDesignIDStr = ""

   
    On Error Goto pError
   
    Call OSPathNetConstruct("", db.Server, db.FilePath, Path)
   
    Call NSFDbOpen( Path, dbHandle)
    If (dbHandle = 0) Then
         Error 1

          Goto pError
    End If
   
   Call NIFFindDesignNote(dbHandle, DesignName,  DesignType, NoteID)

    GetDesignIDStr = Hex$(NoteID)
pError:
   
    If (dbHandle <> 0) Then
         Call NSFDbClose(dbHandle)

     End If
End Function