Page 1 sur 1

Delete StubLess

MessagePublié: 06 Nov 2007 à 17:19
par Michael DELIQUE
D'après un code de Julian Robichaux


Code : Tout sélectionner
Public Function StublessDelete_API(wDoc As NotesDocument) As Integer
%REM
'variableAPI pour la fonction StublessDelete_API
Declare Function OSPathNetConstruct Lib "nnotes.dll" (Byval wnbPortName As Integer, Byval wserverName As String, Byval wfileName As String, Byval wpathName As String) As Integer
Declare Function NSFNoteDelete Lib "nnotes.dll" (Byval wnbHandleDB As Long, Byval wnbNoteID As Long, Byval wnbFlags As Integer) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" (Byval wnbHandleDB As Long) As Integer
Declare Function NSFDbOpen Lib "nnotes.dll" (Byval wdbName As String, wnbRethDB As Long) As Integer
%END REM
   
   'Déclaration Variables
   Dim pathName As String*256
   Dim nbHandleDB As Long
   Dim nbResult As Integer
   Dim nbConvertID As Long
   
   Const UPDATE_NOSTUB = 0512
   Const UPDATE_FORCE = 0001   
   
   On Error Goto ErreurHandle
   
   If wDoc Is Nothing Then
      Error 9999,"wDoc is Nothing"
   End If
   
   StublessDelete_API = True
   
   'ouverture la base de document
   Call OSPathNetConstruct(0, wDoc.ParentDatabase.Server, wDoc.ParentDatabase.FilePath, pathName)
   nbResult = NSFDbOpen(pathName, nbHandleDB)
   If nbResult <> 0 Then
      Error  9999,"Database inaccessible : "+Cstr(nbResult )
      Exit Function
   End If
   
   'conversion du notesID
   nbConvertID = Clng(Val("&H" & Cstr(wDoc.NoteID))) And &H7FFFFFFF
   
   'suppression du document
   nbResult = NSFNoteDelete(nbHandleDB, nbConvertID, UPDATE_NOSTUB Or UPDATE_FORCE)
   If nbResult <> 0 Then
      Error  9999,"Suppression impossible : "+Cstr(nbResult )
      Exit Function
   End If
   
   Call NSFDbClose(nbHandleDB)
   
   Exit Function
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 !"

   StublessDelete_API = False   
   Exit Function
End Function

MessagePublié: 07 Nov 2007 à 14:08
par esolarc
Et c'est quoi ca le stubless ???

MessagePublié: 07 Nov 2007 à 22:11
par Stephane Maillard
Salut,
esolarc a écrit:Et c'est quoi ca le stubless ???

Sauf erreur c'est les talons de suppressions des docs.

MessagePublié: 08 Nov 2007 à 14:58
par esolarc
sous entendu la pseudo corbeille ou on peut récuperer les documents supprimés ?

MessagePublié: 08 Nov 2007 à 15:24
par Stephane Maillard
Salut,

Tiens regarde l'article de base => http://www.nsftools.com/tips/APITips.htm#stublessdelete

Et une discution sur le forum Lotus => http://www-10.lotus.com/ldd/46dom.nsf/D ... enDocument