Delete Folders

Hi !

Id’ll like to delete all folders of my database using LotusScript.

How should I do ??

Tanks :slight_smile:

Subject: Delete Folders

Use notesdatabase.views to get all views and folders, loop through them checking the isfolder property and then remove

Don’t know if that’s the most efficient but should be OK.

Dan

Subject: RE: Delete Folders

I’ve a TypeMissmatch error on Set ViewFolders = db.Views

here’s part of my script :

Dim s As New notesSession

Dim db As notesDatabase

Dim ViewFolders As NotesView

Set db=s.CurrentDatabase

Set ViewFolders = db.Views

Subject: RE: Delete Folders

Have a look in the help file by the way you’ll get good examples in there, but your ViewFolders needs to be a notesviewarray object, not just a single notesview object.

Dan

Subject: RE: Delete Folders

It’s allright using a variant

tank you

Subject: RE: Delete Folders

Why use a variant though? Just use what it’s meant to be. You might not get huge problems using a variant in this case, but if you continue to use variants when you can’t be bothered to look up the proper object you’ll end up with slow(er) code than you need, so when you have a large db with a lot of code things end up grinding to a halt (that’s a bit of an exaggeration of course)

Subject: RE: Delete Folders

Forall v in db.ViewsIf v.IsFolder Then

Call v.Remove(True)

End If

End Forall

or simply open the database in designer and go to the folders view, select all and press delete.