• DetachAll

    By Oleg Miroshnichenko 2 decades ago

    Some our users use the agent below (they have button in Inbox) to save attachments of selecteted messages to selected location. Maybe it will be usefull for some-body else.

    Sub Initialize

    Dim s As New notessession <br/>
    Dim w As New NotesUIWorkspace <br/>
    Dim db As NotesDatabase <br/>
    Dim col As NotesDocumentCollection <br/>
    Dim doc As NotesDocument <br/>
    Dim prof As NotesDocument <br/>
    Dim path As String <br/>
    Set db = s.CurrentDatabase <br/>
    Set col = db.UnprocessedDocuments <br/>
    If col.Count &lt;&gt; 0 Then <br/>
        Set prof = db.GetProfileDocument(&quot;Interest Profile&quot;,s.UserName) <br/>
        If prof.hasitem(&quot;path&quot;) Then <br/>
            If prof.path(0) &lt;&gt; &quot;&quot; Then <br/>
                path = prof.path(0) <br/>
            Else <br/>
                path = &quot;&quot; <br/>
            End If <br/>
        Else <br/>
            path = &quot;&quot; <br/>
        End If <br/>
        stringArray = w.SaveFileDialog( True , &quot;Save to...&quot;, , path ) <br/>
        If          Isempty(stringArray) Then         Exit Sub <br/>
        prof.path = stringArray(0) <br/>
        Call prof.Save(True , True) <br/>
        For i = 1 To col.Count <br/>
            Set doc = col.GetNthDocument(i) <br/>
            If doc.isvalid Then <br/>
                Set rtitem = doc.GetFirstItem(&quot;body&quot;) <br/>
                notesEmbeddedObjectArray = rtitem.EmbeddedObjects <br/>
                For j = 0 To Ubound(notesEmbeddedObjectArray) <br/>
                    Set ee = notesEmbeddedObjectArray(j) <br/>
                    Call ee.ExtractFile( stringArray(0) &amp;&quot;\&quot; &amp; ee.name ) <br/>
                Next <br/>
            End If <br/>
        Next <br/>
    End If <br/>

    End Sub

    • Nice code...

      By Ben Rose 2 decades ago

      But does it really offer much improvement to the detach all feature within the message itself?

      • By Oleg Miroshnichenko 2 decades ago

        I think no.

        But it is usefull when you recieve a lot of similar messages (like summaries, reports etc.) and you want to save all attachments in all selected messages to specific folder.

        • It could...

          By Ben Rose 2 decades ago

          be added to a future release with a "hide when" applied to the button from a checkbox within the calendar profile.

          If anybody else would find this useful, let me know.



    • Delete attachments also?

      By Gary Cousins 2 decades ago

      I've been looking for something to detach attachments and then delete them from the mail database without opening the selected mails. This code is very useful for the first part. Attachments make up the bulk of my user's mail files and this functionallity would be useful to maintain quotas.

    • Add path where saved to?

      By P. J. Maloney 2 decades ago

      It would be great if, when a message is saved and deleted from the memo that the original memo indicate where the attachment was put.

      The 'Delete' and 'Save and Delete' options insert the text:

      [attachment "Attachment Name" deleted by User]

      It would be very helpful if we had functionality to insert text such as:

      [attachment "Attachment Name" saved to "Path" and deleted by User]

      I know there's an attachment log app out there, but for our purposes, this functionality would be much simpler and more useful.

    • DetachAll

      By Alessandro Virzi 2 decades ago