Page 1 sur 1

Effacer le contnu d'un folder

MessagePublié: 05 Sep 2007 à 09:29
par Michael DELIQUE
retire d'un folder tous les document une collection de documents ou un document en particulier

Code : Tout sélectionner
Public Sub FolderDelete(wFolder As String,wnbAll As Integer, wdoc As NotesDocument,wCOllection As NotesDocumentCOllection)
   'Déclaration Variable
   Dim vwFolder As NotesView
   Dim EntryCollection As notesViewEntryCollection
        Dim Session as NotesSession
        Dim db as NotesDatabase
   
   On Error Goto ErreurHandle
   
   Set Session = New NotesSession
   Set DB = Session.CUrrentdatabase
   
   If Trim(wFolder) = "" Then
      Error 9999,"Variable ''wFolder'' non renseigné"
      Exit Sub
   Else
      Set vwFolder = db.GetView(wFolder)
      If vwFolder Is Nothing Then
         Error 9999,"Folder '' "+ wFolder+" '' Introuvable"
         Exit Sub
      End If
   End If
   
   If wnball = False Then
      If wDoc Is Nothing Then
         If wCollection Is Nothing Then
            Exit Sub
         Elseif wCollection.count = 0 Then
            Exit Sub
         End If
      End If
      
      If Not wDoc Is Nothing Then
         Call wDoc.RemoveFromFolder(wFolder )
      End If
      
      If Not wCollection Is Nothing Then
         If wCollection.count > 0 Then
            Call wCollection.RemoveAllFromFolder( wFolder )
         End If   
      End If   
   Else
      Set EntryCollection = vwFolder.AllEntries
      If Not EntryCollection Is Nothing Then
         If EntryCollection.count > 0 Then
            Call EntryCollection.RemoveAllFromFolder(wFolder)
         End If
      End If   
      Set EntryCollection = Nothing
   End If
   
   Call vwFolder.refresh
   Set vwFolder = Nothing
   
   Exit Sub
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Set EntryCollection = Nothing
   Set vwFolder = Nothing
   Exit Sub
End Sub