Use LotusScript to delete private folders

Source: Internet
Author: User

'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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.