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.


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


RELATED CONTENT
LotusScript
Can you use LotusScript to read a text file attached to a Notes doc?
Customize the principal field of outgoing email messages
Can I use LotusScript to merge cells in a Microsoft Word table?
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

Lotus Notes Domino Mailbox Management
Secure Lotus Notes/Domino 8.x from mail to unknown recipients
Run or restart Notes/Domino agents via text messages
How to create mail files using a LotusScript agent
How to turn off the message recall feature in Lotus Notes 8
Domino server setting and email policy tricks admins must know
Customize the principal field of outgoing email messages
LotusScript action button manages Lotus Notes mail files
JavaScript error encountered when opening Lotus Notes email
Bringing MailRule documents back into view
LotusScript agent moves tagged spam email to junk mail folder

LotusScript
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication
Can I create and copy Microsoft Excel spreadsheets with LotusScript?
LotusScript filters and attaches files to a Notes form
How to create mail files using a LotusScript agent
Can you use LotusScript to read a text file attached to a Notes doc?
Extract value pairs from text arrays with 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


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




  • 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



    Lotus Notes Domino on Blackberry and mobile devices
    HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




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