Coping attachments to a specific directory

Hello all, I need to copy an attachment to a specific directory in Windows 2000.

Anybody any ideas???

Pretty urgent

Subject: Coping attachments to a specific directory

Try this code. I did the same. So I pulled the code together which you need. So, you will need to edit to meet your needs. You also may want to add some error handling.

Sub copyAttachment(filePath as string)

Dim ses As New NotesSession

Dim db As NotesDatabase

Dim col As NotesDocumentCollection

Dim doc As NotesDocument



Dim objs As Variant

Dim rti As NotesRichTextItem



Dim file As NotesEmbeddedObject

Dim fileName As String



'*** get unprocessed documents

Set db = ses.CurrentDatabase

Set col = db.UnprocessedDocuments



'*** set first document

Set doc = col.GetFirstDocument



While Not( doc Is Nothing)

	

	'*** get RTI attached objects

	Set rti = doc.GetFirstItem( "Name of RTI" )

	objs = rti.EmbeddedObjects

	

	'*** check all objects

	Forall obj In objs

		

		'*** check if object is an attachment

		If (obj.type = EMBED_ATTACHMENT) Then

			

			'*** get name of object

			fileName = obj.Name

			

			'*** firts get an instance to the embeded object (attachment

			Set file = doc.GetAttachment( fileName )

			

			'*** extract it to disk

			file.ExtractFile( filePath + "/" + fileName )

			

		End If

	End Forall

	

	'*** get next document

	Set doc = col.GetNextDocument(doc)

Wend

End Sub

Subject: RE: Coping attachments to a specific directory

Tried this but nothing happens the button is used. Do have anything else i can try.

Much appreciated

Subject: RE: Coping attachments to a specific directory

What do mean by nothings happens? Even not an error? I am surprised! It has to work because it works for me.

Did you use the SriptDebuger to see what is going on. You will find it under File → Tools → Debug LotusScript

Subject: RE: Coping attachments to a specific directory

I think you do not get into the while loop. Then you will also not have any error. Where are you using the script? In an agent, from, view?In a view you will need to have selected at least 1 document, otherwise, db.unprocessedDocuments will return an empty collection.

You would need to adjust the code if you use it on a form. In agent may be as well.

Give me some more info how you use and I will help as far as I can.