Solved

check attachment name

Posted on 2001-06-07
3
186 Views
Last Modified: 2013-12-18
Hi,

the following codes check the filename of attachments.
It always returns me the first filename. The no. of times it is printed tallies with the no. of attachments. However, if I close the current document, re-open it and run the same codes, it returns me the correct filenames.

It works the same if I save the current doc instead of creating a temporary document.

Is this got to do with Notes itself?

Thanks.
   

  'Check filename attached
     Set tmpdoc = New notesdocument(db)
     Call doc.Copyallitems(tmpdoc, True)
     tmpdoc.Form = "TEMP"
     Call tmpdoc.save(True, True) 'create temporary doc to check attachments
     
     If Not (tmpdoc Is Nothing) Then
          Forall attmt In tmpdoc.Items
               If attmt.Name = "$FILE" Then
                    Print attmt.values(0)
               End If
          End Forall
     End If
0
Comment
Question by:PinkDolphin
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
Comment Utility
You code should be :
Forall attmt in doc.EmbeddedObjects
   Print attmt.name
End Forall

This code will run through all attachments in the current document (I suppose doc refers to the original document in your code) and print theire respective names.

Regards,

Jean Marie
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 50 total points
Comment Utility
Jerrith, Even in your case the doc has to be saved as the embeddedobjects is realized only when the doc is saved.

PinkDolphin,
Use Jerrith's method to access the attachments, Anyway you have to save the document to access the attachments in your doc. This is notes limitation.

~Hemanth
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
Comment Utility
Ah yes, I thought he was referring to an existing document, not a newly created one.
My bad, thanks for the correction Hemanth.

So for a complete code this would be :
'First save the document to actually create the attachments
call doc.Save(True,False)
'Now walk through all attachments to get the names
Forall attmt in doc.EmbeddedObjects
  Print attmt.name
End Forall
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now