Domino 9 und frühere Versionen > ND9: Entwicklung

Dokumente per Lotusscript löschen?

(1/1)

schroederk:
Hallo,

ich möchte gerne alle Dokumente löschen, die in einer View angezeigt werden und ein bestimmtes Item enthalten.
Wie kann ich das am einfachsten machen?

Das folgende Script funktioniert ja leider natürlich nicht:

--- Zitat ---   Set view = db.GetView("meineView")
   Set doc = view.GetFirstDocument
   While Not (doc Is Nothing)
      If doc.Hasitem("MarkedToBeDeleted") Then
         doc.Removepermanently(True)
      End If
      Set doc = view.GetNextDocument(doc)
   Wend   

--- Ende Zitat ---

Muss ich mir erst eine Liste bauen und mir die UNID und am Ende nochmal durch die Liste loopen, um die Dokumente zu löschen?

Mitch:
So zum Beispiel:


--- Code: ---   Set view = db.GetView("meineView")
   Set doc = view.GetFirstDocument
   While Not (doc Is Nothing)
      If doc.Hasitem("MarkedToBeDeleted") Then
         Set docToDelete = doc
      End If
      Set doc = view.GetNextDocument(doc)
      If Not docToDelete Is Nothing Then
         Call docToDelete.RemovePermanently(True)
      End If
   Wend

--- Ende Code ---

Gruß,

Mitch

schroederk:
Stimmt. Da hätte ich auch selber drauf kommen können.
Vielen Dank.

Tode:
oder "andersrum":

--- Code: --- Set doc = view.GetFirstDocument
   While Not (doc Is Nothing)
      Set docNext = view.GetNextDocument(doc)
      If doc.Hasitem("MarkedToBeDeleted") Then
          Call doc.RemovePermanently(True)
      End If
      Set doc = docNext
   Wend
--- Ende Code ---

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln