Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext

Reading an attachment without detaching it [It Worked!]
Daniel X Casey 3.Jan.07 02:05 PM a Web browser
Domino Designer All Releases Windows 2003


Thanks to Tom Kuczek and Andrew Chung.

The only complication is that because DXL uses Base64 encryption, you need to decode the FILEDATA with the Base64 Lotusscript library that you can find here:
http://www.nsftools.com/tips/NotesTips.htm

[The same page also has a really useful script library for parsing CSV files with XML and another one for just reading CSV. These were no good for me, but might be what you're looking for]

Obviously the below code is a bit ugly and you--the person looking to use this code--are going to have to do things so that you take care of multiple attachments, attachments in a different format, work with the right kind of attachment, and you'll probably want some error checking. But we can succesfully read an attachment without detaching it:

Sub Initialize
Dim s As New notessession, db As NotesDatabase, dc As NotesDocumentCollection, d As notesdocument
Dim Stream As NotesStream, export As NotesDXLExporter
Dim x As Integer , st As String, Start As Double, Finish As Double, fd As String

Set db=s.CurrentDatabase
Set dc=db.UnprocessedDocuments
For x=1 To dc.count
Set d=dc.GetNthDocument(x)
If Ucase(d.form(0))="MEMO" Then
'Initalize the stream and DXL Exporters
Set stream=s.createstream
Set export=s.CreateDXLExporter
'Convert the document to DXL
Call export.setInput(d)
Call export.setOutput(stream)
Call export.process
'Process the export into a string file (as long as its less than 2GB)
st=stream.ReadText
'Find the <Filedata> tags and read what's between them
Start=Instr(1,st,"<filedata>")
Finish=Instr(1,st,"</filedata>")
fd=Mid(st,Start +10, Finish-Start-11)
'Decode from Base 64
fd=decodeBase64(fd)
'fd is your resulting data. Do with it what you will.
End If
Next
End Sub




Reading an attachment without detac... (Daniel X Casey 3.Jan.07)
. . RE: Reading an attachment without d... (Tom Kuczek 3.Jan.07)
. . . . RE: Reading an attachment without d... (Daniel X Casey 3.Jan.07)
. . . . . . RE: Reading an attachment without d... (Tom Kuczek 3.Jan.07)
. . . . . . RE: Reading an attachment without d... (Andrew C Chung 3.Jan.07)
. . . . . . . . RE: Reading an attachment without d... (Daniel X Casey 3.Jan.07)
. . . . . . . . Reading an attachment without detac... (Daniel X Casey 3.Jan.07)
. . . . . . . . . . RE: Reading an attachment without d... (Andrew C Chung 4.Jan.07)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite