Domino 9 und frühere Versionen > Entwicklung
Wie kann man Profildokumente löschen?
bob:
Danke Euch beiden, jetzt gehts.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Dim NDC As notesDocumentCollection
Set NDC = db.GetProfileDocCollection( "Profile_Formulare" )
Set doc = NDC.getfirstdocument
While Not (doc Is Nothing)
If doc.isprofile Then
Call doc.remove(True)
End If
Set doc = ndc.getFirstDocument
Wend
Allerdings bleibt da die Sanduhr stehen, aber wenn ich mit Strg+Untbr nach ein paar Sekunden abbreche, sind die Profiledoks gelöscht.
Kann es sein, dass da ne Endlosschleife eingebaut ist?
Bob
joringel:
Jo, ist eine solche....
While Not (doc Is Nothing)
If doc.isprofile Then
Call doc.remove(True)
End If
Set doc = ndc.getFirstDocument
Wend
muss sein:
While Not (doc Is Nothing)
If doc.isprofile Then
Call doc.remove(True)
End If
Set doc = ndc.getNextDocument
Wend
Rob Green:
óla, wir drehen uns im Kreis...man kann ein Doc aus einer Collection nicht löschen (und in dem Falle auch aus der DB) und erwarten, daß die collection das getnextdocument beherrscht...worauf auch getnextdocument..auf das gelöschte und vorher referenzierte Objekt doc? Na...entweder getfirst nehmen wieder oder eine Methode (s.o.) beschrieben, indem man mit einer Kopie des aktuellen Collection Objektes arbeitet.
eknori:
Also wenn ich die Notes Designer Hilfe riichtig gelesen habe, lie´fert die methode GetNotesProfileDocuments doch eine NotesDocumentCollection zurück.
Und diese Notes DocumentCollection hat die methode RemoveAll(True) um Alle Docs dieser Collection auf einen Schlag zu löschen.
Also
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Dim NDC As notesDocumentCollection
Set NDC = db.GetProfileDocCollection( "Profile_Formulare" )
Call NDC.RemoveAll (true)
Das sollte es doch auch tun, gell ?? ;D
ata:
... ja warum eigentlich nicht ... :P
ata
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln