Page 1 sur 1
Supprimer un groupe

Publié:
27 Oct 2010 à 10:47
par Michael DELIQUE
- Code : Tout sélectionner
Function GroupeDelete(wDBNAB As NotesDatabase,wServer As String, wGroupe As String, wnbCacheReset As Boolean) As Boolean
Dim Session As New NotesSession
Dim nmServer As NotesName
Dim nmGroupe As NotesName
Dim vwGroupe As NotesView
Dim DocGroupe As NotesDocument
On Error Goto ErreurHandle
GroupeDelete = False
If Trim(wGroupe) = "" Then
Error 9999,"wGroupe isEmpty"
Else
Set nmGroupe = New NotesName(Trim(wGroupe))
End If
If wDBNAB Is Nothing Then
If Trim(wServer) = "" Then
Set nmServer = New NotesName(Session.CurrentDatabase.Server)
Else
Set nmServer = New NotesName(Trim(wServer))
End If
Set wDBNAB = DBOpenNAB(nmServer.Abbreviated)
Else
Set nmServer = New NotesName(wDBNAB.Server)
End If
If wDBNAB Is Nothing Then
Error 9999,"wDBNAB is Nothing"
Exit Function
End If
Set vwGroupe = wDBNAB.GetView("($Groups)")
If vwGroupe Is Nothing Then
Error 9999,"vwGroupe '($Groups)' is Nothing"
Exit Function
End If
Call vwGroupe.Refresh
Set DocGroupe = vwGroupe.GetDocumentByKey(nmGroupe.Abbreviated,True)
Set vwGroupe = Nothing
If Not DocGroupe Is Nothing Then
Call DocGroupe.Remove(True)
GroupeDelete = True
Set DocGroupe = Nothing
End If
Set nmGroupe = Nothing
If wnbCacheReset = True Then
If GroupeDelete = True Then
Call Session.SendConsoleCommand(nmServer.Canonical, "show nlcache reset")
Call Session.SendConsoleCommand(nmServer.Canonical, "DBCache Flush")
End If
End If
Set nmServer = Nothing
Exit Function
ErreurHandle:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Cstr(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
GroupeDelete = False
Exit Function
End Function