How to change a share folder to private folder

How to change a share folder to private folder

Messagepar Stephane Maillard » 01 Août 2005 à 13:26

[syntax="ls"]Const wAPIModule = "NNOTES" ' Windows/32



Const DESIGN_TYPE_PRIVATE_DATABASE = 1

Const NOTE_CLASS_VIEW = 8

Const DFLAGPAT = "(+-04nV*F" ' visible shared folder



Declare Function FolderCreate Lib wAPIModule Alias "FolderCreate" _

( Byval hDB As Long, Byval hF As Long, Byval N As Long, Byval hN As Long _

, Byval T As String, Byval nT As Integer, Byval D As Long, Byval F As Long _

, R As Long) As Integer

Declare Function FolderDelete Lib wAPIModule Alias "FolderDelete" _

( Byval hDB As Long, Byval hF As Long, Byval N As Long, Byval F As Long) As Integer

Declare Function FolderDocAdd Lib wAPIModule Alias "FolderDocAdd" _

( Byval hDB As Long, Byval hF As Long, Byval N As Long _

, Byval hT As Long, Byval F As Long) As Integer



Declare Function IDDestroyTable Lib wAPIModule Alias "IDDestroyTable" _

( Byval hT As Long) As Integer



Declare Function NIFFindDesignNoteExt Lib wAPIModule Alias "NIFFindDesignNoteExt" _

( Byval hDB As Long, Byval T As String, Byval C As Integer _

, Byval P As String, N As Long, Byval F As Long) As Integer



Declare Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _

( Byval P As String, hDB As Long) As Integer

Declare Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _

( Byval hDB As Long) As Integer



Declare Function NSFFolderGetIDTable Lib wAPIModule Alias "NSFFolderGetIDTable" _

( Byval hDB As Long, Byval hDD As Long, Byval N As Long _

, Byval F As Long, hT As Long) As Integer



Declare Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _

( Byval P As Long, Byval S As String, Byval F As String, Byval N As String) As Integer





Sub Click(Source As Button)

Const ButtonTitle = "Make Folder Private"

Const ErrorTitle = ButtonTitle & " - Error"



f$ = Trim$(Inputbox$("Folder name:", ButtonTitle, ""))

If f$ = "" Then Exit Sub



Dim session As New NotesSession



Dim db As NotesDatabase

Set db = session.CurrentDatabase



Dim hDB As Long

pn$ = Space(1024)

OSPathNetConstruct 0, db.Server, db.FilePath, pn$

NSFDbOpen pn$, hDB



NIFFindDesignNoteExt hDB, f$, NOTE_CLASS_VIEW, DFLAGPAT, id0&, 0

If id0& = 0 Then

Messagebox "Can't find shared folder " & f$, 16, ErrorTitle

NSFDbClose hDB

Exit Sub

End If



FolderCreate hDB, 0, id0&, hDB, f$, Len(f$) _

, DESIGN_TYPE_PRIVATE_DATABASE, 0, id1&

If id1& = 0 Then

Messagebox "Can't create private folder", 16, ErrorTitle

NSFDbClose hDB

Exit Sub

End If



Dim hT As Long

NSFFolderGetIDTable hDB, hDB, id0&, 0, hT

FolderDocAdd hDB, 0, id1&, hT, 0

IDDestroyTable hT

FolderDelete hDB, 0, id0&, 0



NSFDbClose hDB



Messagebox "Folder " & f$ & " is now private. Close the database and reopen it", 64, ButtonTitle

End Sub[/syntax]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Retour vers API

cron