How to detach attachments in notes?


How do i detach attachments to a specified directory in notes by selecting the document and clicking a button. And also it should launch the application after detaching???
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

snocrossConnect With a Mentor Commented:
This script detaches and removes all the file attachments in a document's Body item that are larger than 100,000 bytes. (This size can be adjusted) The first file attachment that's found gets detached to c:\reports\newfile1, the second attachment that's found gets detached to c:\reports\newfile2, and so on.
Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer
Const MAX = 100000
fileCount = 0
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) _
And ( o.FileSize > MAX ) Then
fileCount = fileCount + 1
Call o.ExtractFile _
( "c:\reports\newfile" & Cstr(fileCount) )
Call o.Remove
Call doc.Save( True, True )
End If
End Forall
End If
Are you saying you want to detach it programatically instead of manually specifying the location?  And are you also saying you want to automatically launch the attachment afterwards without having to manually double-click the attachment?
Hi Fenil,

Did you say that you want to detach attachments from a mail or attachments from a "Body" field ?

Jus Curious...

Can you give a bit more explaination on the document that you want to process ?


fenilAuthor Commented:
Yeah it worked when i added the handle to the document etc...

All Courses

From novice to tech pro — start learning today.