Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: gere am 12.07.05 - 14:51:49

Titel: Mail an Dokument hängen
Beitrag von: gere am 12.07.05 - 14:51:49
Hallo zusammen,

Wie in aller Welt kann man eine Email aus $Inbox in ein RichTextField in einer Notes-Datenbank anhängen?  ???
Das Prinzip soll so funktionieren wie mit der Büroklammer und Dateianhängen. Ich erstelle eine Aktion, die den Posteingang öffnet, dort wähle ich eine Email aus, kopiere den Content und füge ihn in ein RichTextFeld in einer Datenbank. Das MailTemplate sollte dabei natürlich nicht verändert werden.

Hat sowas schon mal jemand realisiert?

Vielen dank, das würde mich enorm weiterbringen.

Gruß Gere
Titel: Re: Mail an Dokument hängen
Beitrag von: klaussal am 12.07.05 - 15:12:57
So ähnlich:
Code
Sub Initialize
	Dim ws As New NotesUIWorkspace
	Dim session As New NotesSession
	Dim doc As NotesDocument
	Dim uidoc As NotesUIDocument
	Dim docNew As NotesDocument
	Dim view As NotesView
	
	Dim dc As NotesDocumentCollection
	Dim db As NotesDatabase
	
	Dim strDBName As String
	Dim collection As NotesDocumentCollection
	Dim docColl As NotesDocument
	
	Dim intI As Integer
	
	Dim strServer As String
	Dim strView As String
	Dim strMail As String
	
	Dim rtitemA As Variant
	Dim rtitemB As Variant
	Dim varDummy As Variant
	
	Dim richStyle As NotesRichTextStyle
	
	'Set uidoc = ws.currentDocument
	Set richStyle = session.CreateRichTextStyle
	
	strMail= session.GetEnvironmentString( "MailFile"  , True)
	
	strView = "$Inbox"
	strServer = "Servername"
	strDBName = strMail
	'Set doc = uidoc.document
	Set db = session.CurrentDatabase
	Set collection = ws.PickListCollection( PICKLIST_CUSTOM, True, strServer, strDBName, strView, "Mailauswahl", "Bitte wählen Sie eine Mail aus")
	
	If collection Is Nothing Then		
		Msgbox "gecancelt"
	Else
		
		Set docColl = collection.GetFirstDocument
		If docColl Is Nothing Then
			Exit Sub
		Else
			Do While Not docColl Is Nothing
				Set docNew = db.createDocument
				docNew.form = "Topic1"
				
				Set rtitem = New NotesRichTextItem( docNew, "DawText" )
				richStyle.Bold = True
				Call rtitem.AppendStyle(richStyle)
				Call rtitem.AppendText( "Absender" )
				Call rtitem.AddNewLine( 1 )
				Call rtitem.AppendText( docColl.from(0) )
				Call rtitem.AddNewLine( 1 )
				Call rtitem.AppendText( "Datum" )
				Call rtitem.AddNewLine( 1 )
				If docColl.HasItem( "DeliveredDate" ) Then
					Call rtitem.AppendText( docColl.DeliveredDate(0) )
				Else
					Call rtitem.AppendText( docColl.PostedDate(0) )
				End If
				richStyle.Bold = False
				Call rtitem.AppendStyle(richStyle)
				Call rtitem.AddNewLine( 2 )
				Set rtitemA = docColl.GetFirstItem( "Body" )
				Set rtitemB = docNew.GetFirstItem( "DawText" )
				If ( rtitemA.Type = RICHTEXT And _
				rtitemB.Type = RICHTEXT ) Then
					Call rtitemB.AppendRTItem( rtitemA )
				End If				
				docNew.Kategorie_1 = docColl.Subject(0)
				Call docNew.save (True, True)
				Set docColl = collection.getNextDocument (docColl)
			Loop
		End If
	End If
	
	Set view = db.GetView("Themen_Alle")
	Call view.Refresh
	
End Sub
Titel: Re: Mail an Dokument hängen
Beitrag von: gere am 12.07.05 - 15:22:44
Danke, werde das mal probieren... Geht das auch irgendwie mit Formelspache?

Gruß Gere
Titel: Re: Mail an Dokument hängen
Beitrag von: koehlerbv am 12.07.05 - 16:42:08
Warum sollte man das in Formelsprache tun (und sich hierbei einen abbrechen, wenn es denn überhaupt gehen würde) ?

Bernhard