Solved

check attachment name

Posted on 2001-06-07
3
190 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

756 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