Home > Ask the Domino Experts > LotusScript Questions & Answers > LotusScript to extract and move attachments to a Lotus Notes mailbox or file folder
Ask The Domino Expert: Questions & Answers
EMAIL THIS

LotusScript to extract and move attachments to a Lotus Notes mailbox or file folder

Cregg Hardwick EXPERT RESPONSE FROM: Cregg Hardwick

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 01 May 2007
I'm trying to find a script that will extract and email attachments to a folder of my choice. I'd also like it to print the name of the attachment in the email from which it was removed. Thank you.

>
EXPERT RESPONSE

I assume that you mean you want to email the attachments to a Lotus Notes mailbox of your choice, as putting them in a folder on the file system is a completely different issue. But, here is how to do both both:

To begin with, creating a directory is easy. LotusScript provides the MkDir command, which takes the pathname of the new folder as a parameter. If appropriate, use the Dir$ command to check to see if the directory (or files within it) already exists.

Now, to extract all attachments, just get a handle to the rich text document and use code similar to the following…

If Not Isempty(rtitem.embeddedObjects) 
Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT )  
Then
Call o.ExtractFile ( AttachmentDirectory+
"\"+o.name )
End If
End Forall

The test to see if the object is an embedded attachment must be done. Otherwise, the code would trip over any files embedded as OLE objects (which cannot be detached).

Keep in mind that if you have an old pre-R5 Lotus Notes database, attachments may be stored in the documents object collection, instead of those for the rich text field. In theory, the same concepts apply; you just cannot pick a particular rich-text field to extract from. (See the Designer Help for more detail, if needed.)

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from SearchDomino.com:

  • Tip: Extract attachments and indicate a new location
  • Expert Advice: Extracting and reattaching attachments
  • FAQ: LotusScript advice
  • Reference Center: LotusScript tips and resources


  • Sound Off! -   Be the first to post a message to Sound Off!


    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


    RELATED CONTENT
    LotusScript
    Modifying LotusScript code for date and time handling
    Use DXL utilities for advanced replication settings in Notes
    Use LotusScript to create encrypted replicas
    Write a LotusScript agent to automate file attachments
    Troubleshooting a scheduled agent not running on a Global Notes Architecture (GNA) server
    Setting up local replication of a Lotus Notes database for offline employees
    Creating a link on an HTML page to a Microsoft Word attachment in a Lotus Notes database
    Copying a rich-text field with attachments to a Lotus Notes document
    How to convert Lotus Notes documents to .PDF files
    Can I stop Lotus Domino Server from transforming embedded images into attachments?

    Lotus Notes Domino Mailbox Management
    Bringing MailRule documents back into view
    LotusScript agent moves tagged spam email to junk mail folder
    Limit the size of incoming email attachments to a Lotus Domino server
    Show unread marked Lotus Notes email messages using LotusScript
    Sending specific agent errors to a mailbox instead of debugging
    Setting corporate mail file size policies on NSF files
    No more delayed email
    Application for queueing non-delivery reports on hub mail server
    Need to restrict who can send Internet mail and from where
    Can Microsoft Outlook be used with Domino without installing Notes client?

    LotusScript
    LotusScript equivalent of @Picklist for Lotus Notes
    Launch large attachments within an email from a Notes database
    How to find files on a hard drive or mapped network with LotusScript
    Update the ACL from the Roles view with LotusScript
    LotusScript agent moves tagged spam email to junk mail folder
    Set a value in a field existing in another Lotus Notes database
    Create an automatic scheduled view export in Excel
    Top 10 LotusScript tips
    Create a personalized greeting for Lotus Notes database users
    Fail-safe rich-text validation using LotusScript

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary



    Search and Browse the Expert Answer Center
    Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
    Browse our Expert Advice

    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




    All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts