Improve company productivity with a Business Account.Sign Up

x
?
Solved

EmbeddedObjects,attachments and Excel

Posted on 2000-03-22
14
Medium Priority
?
389 Views
Last Modified: 2013-12-18
Hi all!
I am sending an .xls document throught Excel to a Mail-in database. There i want to "take" this embeddedobjects (or attachments, what ever) and embed them in a richtext field of a new document.
In the properties of the doc containing the ecel file, HASEMBEDDED=True but EMBEDDEDOBJECTS is empty so when i try :
forall o in doc.embeddedobjects
it says Type Mismatch.
Can some one give me a code to do this?
Thank you,
Koray.
0
Comment
Question by:koray_uygun
  • 8
  • 6
14 Comments
 

Author Comment

by:koray_uygun
ID: 2648732
Adjusted points from 100 to 150
0
 

Author Comment

by:koray_uygun
ID: 2663680
Adjusted points from 150 to 200
0
 

Author Comment

by:koray_uygun
ID: 2706808
Adjusted points from 200 to 300
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2729229
If the document was mailed into the database via a excel to a mail in database then I think the attachment will be in the body field of the document not in the document itself

So you should change the code to

Dim Wspace As New NotesWorkspace
Dim uiDoc As Notesuidocument
Dim Doc As NotesDocument
Dim rtitem As NotesRichTextItem


Set uiDoc = Wspace.CurrentDocument
Set Doc = uiDoc.Document
Set rtitem = Doc.GetFirstItem( "Body" )

forall o in rtitem.embeddedobjects
.......
End Forall


Give this a go and get back to me....
0
 

Author Comment

by:koray_uygun
ID: 2729762
Adjusted points from 300 to 350
0
 

Author Comment

by:koray_uygun
ID: 2729763
Sorry Simon, the problem is that this attachment is not in the body field, that's why i can't "take" it. The attachment is like "under" the document separeted from it by an horizontal line.
Thank you for trying,
Koray.
0
 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2732457
Ok , Sorry now I understand your question... Yes this is a tricky one because the embeddedobjects array does not contain these attachments , the same type of thing occurs when you upload files from the web via an upload control... Here the code to use...


Dim Wspace As New NotesWorkspace
Dim uiDoc As Notesuidocument
Dim Doc As NotesDocument
Dim rtitem As NotesRichTextItem

     Set Doc = uiDoc.Document
     Forall i In doc.Items
          If i.type = Attachment Then
               Set nitem = doc.GetFirstItem(i.name)
               Set emb = doc.GetAttachment(i.values(0))
               Set rtitem=doc.getfirstitem("Body")
               Call emb.extractfile("C:\" & emb.name)
               Call rtitem.embedobject(EMBED_Attachment, "", "C:\" & emb.name, emb.name)
               Call emb.remove
          End If
     End Forall

This code gets the attahment from "under" the document seperator and moves it into the body field of the document... Hope I got it right this time
0
 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2732460
In the first line it should be notesuiworkspace not notesworspace... Sorry typo
0
 

Author Comment

by:koray_uygun
ID: 2733640
Sorry again Simon,
i have tried this one already and it doesn't work. There isn't any item whos type is attachment in the incoming mail. The attachment file is in an item called $File whos type is not Attachment and when i try to "take" the value of $File, the script can't find the item in the document, it is really strange.
Have a nice day,
Koray.
0
 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2741609
I am now fascinated by this , is it possible that you can e-mail me a copy of this database with a single example document in it ??

If it is to secure I understand

Simon Hendry
0
 

Author Comment

by:koray_uygun
ID: 2741733
Ok, i'll send a copy tuesday, Have a nice "Paques" (eggs) week-end,
Koray.
0
 
LVL 3

Expert Comment

by:Simon_Hendry
ID: 2749913
shendry@families.qld.gov.au
0
 
LVL 3

Accepted Solution

by:
Simon_Hendry earned 1400 total points
ID: 2750762
Hi again..

I got your database and did the following

Updated the MemoDeBase form and added a Richtext Editable field called "Body" and a editable text field called "Converted"

I then wrote a agent to go through document in the database that used the MemoDebase form and haven't yet been converted and moved the attached file from the form to the body field.. with the following code

'Code starts

     Dim Sess As New NotesSession
     Dim ThisDb As NotesDatabase
     Dim Coll As NotesDocumentCollection
     Dim Search As String
     Dim Doc As NotesDocument
     Dim rtitem As NotesRichTextItem
     
     Search = "Form=""MemoDeBase"" & Converted!=""Yes"""
     
     Set ThisDb = Sess.CurrentDatabase
     Set Coll = ThisDb.Search(Search,Nothing,0)
     
     For Counter =1 To Coll.Count
         
          Set doc = Coll.Getnthdocument(Counter)
          Forall i In doc.Items
               If i.type = Attachment Then
                    Set nitem = doc.GetFirstItem(i.name)
                    Set emb = doc.GetAttachment(i.values(0))
                    Set rtitem=doc.getfirstitem("Body")
                    Call emb.extractfile("C:\" & emb.name)
                    Call rtitem.embedobject(EMBED_Attachment, "", "C:\" & emb.name, emb.name)
                    Call emb.remove
               End If
          End Forall
          Doc.Converted = "Yes"
          Call Doc.Save(True,False)
         
     Next Counter


' Code Ends

This code worked for me with my notes client version 4.6.2 and versions 4.5.1 ... It moved the attached file from the document below the line to the Body field... If after you do this it does not work I am unsure why.. There are some documents in the Knowledge base that mention problems with doing this in versions prior to 4.5.2 , but as I say I had no problem with 4.5.1...

Give it a go...

If it doesn't work have a look at knowledge base at

http://support.lotus.com/sims2.nsf/802ee480bdd32d0b852566fa005acf8d/79ef1db0ab683fb88525643400569cea?OpenDocument

This is a document ( and link to other documents ) that talk about this sort of problem...

Hope I have helped

Simon Hendry
0
 

Author Comment

by:koray_uygun
ID: 2750863
Halleluiah!!!
Thank you very much.
By the way, do you think there's work for a french Lotus Notes certified developper in australia?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

608 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