About detach attachments

If in my inbox, i have 300 emails which are never opened.  Each of the email has 1 or more attachments on it.  How can i using a very quick method to detach them all at once.  If the proposed solution is using script or application, please give it to me.  Thanks.
Who is Participating?
ArunkumarConnect With a Mentor Commented:
Hi HenryChang ,

Try the following.
create an action button in the folder ($Inbox). Paste the code in the button and now,  you can select the documents
on which the code should run. This will detach the files of the selected docs.

Good Luck !


PS : Find "F:\AAA\" and replace it with the folder you want to detach the files.
The detached files will have FileName+(randomnumber).extension to avoid overwriting.

For more details link to:


     Dim ss As New notessession
     Dim db As notesdatabase
     Dim view As notesview        
     Dim rndno As Double
     Dim doc As NotesDocument
     Dim rtitem As NotesRichTextItem
     Dim dc as notesdocumentcollection

     Set db = ss.currentdatabase
     Set view = db.getview("($Inbox)")
     Set dc = db.Unprocesseddocuments

     Set doc = dc.getfirstdocument
     Do While Not doc Is Nothing
          If doc.HasEmbedded Then
               Forall m In doc.Items                
                    If m.Type = RICHTEXT Then
                         FieldName = m.Name
                         Set rtitem = doc.GetFirstItem( FieldName )
                         ' Check wether the rtitem has embedded objects                          
                         If Isarray (rtitem.EmbeddedObjects) Then
                              Forall obj In rtitem.EmbeddedObjects
                                   If ( obj.Type = EMBED_ATTACHMENT ) Then
                                        rndno = Int ( Rnd() * 10000 )                                                                                  
                                        tt = Instr(1, obj.source , "." )
                                        If tt <> 0 Then
                                             filename1 = Left(obj.source , tt - 1)
                                             filenameextn = Right(obj.source, Len(Cstr(obj.source)) - tt )                                              
                                             Call obj.ExtractFile( "F:\AAA\" & filename1 & "(" & rndno &")" & "." & filenameextn )
                                             filename1 = obj.source                                              
                                             Call obj.ExtractFile( "F:\AAA\" & obj.source & "(" & rndno &")")
                                        End If
                                   End If
                              End Forall
                         End If      
                    End If                      
               End Forall
          End If
          Set doc = dc.getnextdocument(doc)            
HenryChangAuthor Commented:
Thanks for your answer.  But how can i create the button.  I have no any experience in Lotus Notes and also of application.  Please teach me.  Thanks
HenryChangAuthor Commented:
How can i place create a button in the Inbox, please tell me.
All Courses

From novice to tech pro — start learning today.