Domino 9 und frühere Versionen > Entwicklung
Anhänge löschen wenn vorhanden
MrMagoo:
Hallo habe da doch nochmal ein Frage.
dieser Agent nimmt sich die markierten Mails und löscht die Anhänge heraus. Wie kann ich Abfragen ob überhaupt ein Anhang vorhanden ist??
Sub Initialize
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Dim object As NotesEmbeddedObject
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
Call o.Remove
Call doc.Save( False, True )
End Forall
End If
Set doc = collection.GetNextDocument(doc)
Wend
End Sub
MrMagoo:
Tja manchmal habe ich dann doch nen Geistesblitz
so gehts
Sub Initialize
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Dim object As NotesEmbeddedObject
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
If collection.Count = 0 Then
Msgbox "Kein Dokument ausgewählt"
Else
Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
If Isarray( rtitem.embeddedObjects) Then
Forall o In rtitem.EmbeddedObjects
Call o.Remove
Call doc.Save( False, True )
End Forall
Else
Msgbox "is nicht"
End If
End If
Set doc = collection.GetNextDocument(doc)
Wend
Msgbox "Anhang / Anhänge gelöscht"
End If
End Sub
Thomas Schulte:
Gut außenrum Programmiert aber wie wäre es denn mit
flag = notesDocument.HasEmbedded ?
Thomas
BradCirclepit:
Das funktioniert soweit echt gut! Wenn man jetzt allerdings Termine in der Schablone hat wird die Fehlermeldung ``object variable is not set`` ausgegeben. Wie könnte man diese Fehlermeldung umgehen, oder von Grund auf ausschließen?
koehlerbv:
Termine? In der Schablone? Was willst Du uns damit sagen? Und wie sieht Dein Code aus und wo kommt die Fehlermeldung?
Bernhard
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln