Solved

check attachment name

Posted on 2001-06-07
3
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6166644
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
ID: 6167732
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
ID: 6167758
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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