'Clarations
Const apimodule = "nnotes"
'Windows/32 only
Const note_class_view = & h0008
Declare function ospathnetconstruct lib apimodule alias "ospathnetconstruct" (byval nullport as long, byval server as string, byval file as string, byval pathnet as string) as integer
Declare function nsfdbopen lib apimodule alias "nsfdbopen" (byval pathname as string, dbhandle as long) as integer
Declare function nsfdbclose lib apimodule alias "nsfdbclose" (byval dbhandle as long) as integer
Declare function niffindprivatedesignnote lib apimodule alias "niffindprivatedesignnote" (byval HDB as long, byval notename as string, byval noteclass as integer, noteid as long) as integer
Sub deleteprivateview (dB as notesdatabase, vname as string)
'To open a domino database on a server, use this function to create
'The full path specification, and pass this specification as input to nsfdbopen
'Or nsfdbopenextended.
P $ = string (1024 ,"")
Ospathnetconstruct 0, DB. server, DB. filepath, p $
'This function takes a pathname to an existing domino database or database
'Template (whether on a Lotus Domino Server or a local database), opens
'Database, and returns a handle to it. All subsequent access to the database is
'Carried out via this handle. Use nsfdbclose to close the database file handle
'And deallocate the memory associated with it.
Dim HDB as long
Nsfdbopen p $, HDB
'Giveen the name and note_class_xxx of a private design note (Form, view,
'Folder, helpindex, Macro, field, or replication formula), this function returns the Note ID.
'Uses the view or folder name passed to it-vname.
Dim retnoteid as long
Dim result as integer
Result = niffindprivatedesignnote (HDB, vname, note_class_view, retnoteid)
'If result is anything other than 0, the private design note cocould not be found
If result = 0 then
Dim doc as notesdocument
'Get the private view or folder by its noteid
Set Doc = dB. getdocumentbyid (hex $ (retnoteid ))
Call Doc. Remove (true)
Print "Removing:" & vname
End if
'This function closes a previusly opened database.
Nsfdbclose HDB
End sub
Test:
Sub click (source as button)
Dim s as new notessession
Dim dB as notesdatabase
Set DB = S. currentdatabase
'Pass the name of the private view or folder to delete
Call deleteprivateview (dB, "customquery ")
End sub