120 pts.
 Email attachments from Domino Server to IFS share?
Can an agent extract email attachments from a user's mailbox, and move them to an IFS folder on another iSeries (AS400) box without notes cline running? 

We have a generic email account that receives email attachments, but there are no Notes Clients that will be watching it, so this agent would have to react when new mail is received, and extract the attachment and drop it in an IFS share.

Can this be done?



Software/Hardware used:
Domino 8.0.2 on iSeries
ASKED: September 14, 2009  10:31 PM
UPDATED: September 23, 2009  12:06 PM

Answer Wiki:
Hi Hdwest61 Sure you can ! As you said, your agent have to be in the user mail box and will be run by the Domino server, trigered on the "New mail" event. Create a special folder in the IFS where you will detache your documents. I have some Lotus Script code to do that if you are interesting...
Last Wiki Answer Submitted:  September 16, 2009  6:00 am  by  BruceWayne   4,075 pts.
All Answer Wiki Contributors:  BruceWayne   4,075 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Yes, I’m very interested in looking at the code.

I’ve been chasing down connections to DB2 in the hope I could get to IFS that way, but no luck.

 120 pts.

 

You are touching one of my challenges on my to-do list.. I’ll also be very grateful to see actual code. :-)
I’ll look forward andhope youwill publish the actual code.
Thanks in advance.

 2,540 pts.

 

OK You will have this code.
Do you know LotusScript ? If i give you my code as is, do you will know how to adapt it (delete what you don’t need, change variables, and so on) or you prefer i give you the source a bit rewrited (with comment) ?
In the second case, you have to wait a couple of days cause i’m very busy now…
And sorry for my poor english !

 4,075 pts.

 

I can get by with the raw code.

I knwo VB, and have been working the LotusScrit for a while.

I can read the uncommented code and get what i need from it.

 120 pts.

 

Bruce… are you still out there?

 120 pts.

 

Yep, here is the code :

OPTIONS
Option public
Option Declare
INITIALIZE
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim viewInbox  As NotesView
	
Dim tabItem As Variant, tabTemp As Variant
Dim sPathFichierExport  As String
Dim  sPlateForme As String
	
Set db = s.CurrentDatabase
Set viewInBox = db.GetView( "($InBox)"  ) 
	
sPlateForme = s.Platform
If splateForme <> "Windows/32" Then
	sPathFichierExport = "/MY_IFS_SHAREFOLDER_NAME/"
Else
	sPathFichierExport = "\MY_ISERIES_NAMEMY_IFS_SHAREFOLDER_NAME"
End If
	
Set doc = viewInBox.GetFirstDocument
Do While Not doc Is Nothing
	tabItem = doc.Items
	Forall ele In tabItem
		If ele.Type = RICHTEXT  Then
			tabTemp = ele.EmbeddedObjects
			If Not Isempty(tabTemp) Then
				Forall embobj In tabTemp
					If embobj.Type = EMBED_ATTACHMENT Then
						Call embObj.ExtractFile ( sPathFichierExport + embobj.Name ) 
						' If file exists on the disk, then the attachment is removed !
						If yaFichier( sPathFichierExport + embobj.Name ) = 1Then
							Call embObj.Remove
							Call doc.Save( True, False) 
						End If
					End If	
				End Forall
			End If
		End If
	End Forall
	Set doc = viewInBox.GetNextDocument( doc )
Loop
	
Quit:
	Exit Sub
	
ErrorHandler:
	Print "Erreur ligne " & Erl & " type " & Err  & " - " & Error 
	Goto Quit

Function YaFichier( strFichier As String ) As Integer
If Dir( strFichier , 0 ) = “” Then
YaFichier = 0
Else
YaFichier = 1
End If
End Function


 4,075 pts.