Is it possible to extract an attachment in a document in IBM Domino Notes. I want to effectively run a script that will extract certain attachments in certain documents. I literally have no idea where to start :'(
3 Answers
If you literally have no idea where to start, here's a rule of thumb: Start with Google instead of StackOverflow.
Search string: lotus notes attachments example script
Hit #1 refers to LCLSX.
Ignore that.
Hit #2 is an IBM help page Working with attachments and embedded objects in LotusScript® classes
Okay, that looks promising. It brings up a lot of info, but it's isolated reference info, not tutorial. But look! Down at the bottom of the page! There's a link labeled Examples: Working with attachments and embedded objects in LotusScript® classes.
That's pretty much exactly what you need. That's literally where to start.

- 14,463
- 2
- 23
- 41
My general advice:
open IBM Domino Designer Documentation and search for a topic you are interested in.
Enter "attachment" into search field in this case and you will get a list of hits.
The seven's entry shows "ExtractFile (NotesEmbeddedObject - LotusScript)".
You'll find the description how to extract an attachment including an example in this document.
Here is an example on StackOverflow.

- 1
- 1

- 30,880
- 4
- 31
- 67
There are several ways to do that. I will describe a simple one.
Assume currentDoc
is current document (NotesDocument
instance). And assume there's only one attachment to this document.
Dim commandResult As Variant
Dim attachedFileName As String
commandResult = Evaluate({@AttachmentNames}, currentDoc) 'getting attachment names
attachedFileName = commandResult(0) 'getting the first value from the list of attached names
if attachedFileName = "" then
MsgBox "There's no attached file in this document", 64, "Note"
Exit Sub
End If
Set attachedFileObject = currentDoc.Getattachment(attachedFileName) 'getting object with attached file
Call attachedFileObject.ExtractFile( {C:\Temp\} + attachedFileName) 'extracting file to the C:\Temp folder
In case you want to detach all files iterate over commandResult
that will contain names of all attached files.