types - How to retrieve Lotus Notes attachments? -


i’m trying export of documents , attachments lotus notes database (with designer 7.0). can document data , can attachment, if hard code name. 2 methods, in lotusscript, i’ve found getting filename programmatically aren’t working, shown in lower 2 code blocks. in first, doc.getfirstitem( "body" ) returns nothing, , in second, there’s type mismatch during execution on forall line. on how extract attachments appreciated! i’m not sure whether attachments stored “attachments” or ole, suspect attachments, since they’re pdfs.

sub click(source button)   dim session new notessession dim db notesdatabase dim query string dim collection notesdocumentcollection dim doc notesdocument dim filecount integer dim attachment notesembeddedobject  dim filename string  set db = session.currentdatabase ' document has attachment set collection = db.ftsearch( "06/25/2013", 10 )  filenum% = freefile() filename$ = "c:\kcw\lotusexport.txt" open filename$ output filenum% write #filenum%, "docs found", collection.count  set doc = collection.getfirstdocument ' write out document properties forall x in doc.items     write #filenum%, x.name, " = ",  x.text end forall 'extract document (using hardcoded name) set attachment = doc.getattachment("ocse-front_scantodesktop_06262013-104822.pdf") call attachment.extractfile _ ( "c:\kcw\attachment" )  'try attachment through "body", rtitem nothing set rtitem = doc.getfirstitem( "body" ) write #filenum%, "rtitem nothing", rtitem nothing filecount = 0 if not rtitem nothing     if ( rtitem.type = richtext )         write #filenum%, "rtitem richtext"         forall o in rtitem.embeddedobjects             write #filenum%, "has embedded objects"             filecount = filecount + 1             write #filenum%,"rtitem num", filecount             call o.extractfile _             ( "c:\kcw\newfile" & cstr(filecount) )         end forall     end if end if  'fails "type mismatch" @ forall loop if doc.hasembedded     write #filenum%, "doc has embedded"          forall objects in doc.embeddedobjects         write #filenum%, "in loop"         write #filenum%, "filename= ", object.source     end forall end if  close filenum% end sub 

that give list of attachments in document

objects =  evaluate("@attachmentnames", doc) 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -