HasEmbedded True but getEmbedded returns nothing

Actually this problem is discussed here so many times but I still could not find the

sloution…

Please someone help,

I work with Lotus notes script and found a problem.

To extract attachment from the NSF file when I

check for HASEMBEDDED property it says true but

setting Documents embeded object retuns

nothing.

I looked into different places and found that

these attachments are not part of body of the

email and they are called “v2-style”

attachments but can you give me a sample code

to extract these types of attachments

programetically?

Subject: HasEmbedded True but getEmbedded returns nothing

Try this … Just modify the name of the file attachment.

Hope this helps !

Dim object As NotesEmbeddedObject

Set object = doc.GetAttachment( “FileName.txt” )

Call object.ExtractFile("C:\TEMP" & object.name)

Subject: RE: HasEmbedded True but getEmbedded returns nothing

IBM has Posted This:How to Convert Notes V2/Web-Style Attachment to Attachment Within a Rich Text Field via LotusScript

AT:http://www-1.ibm.com/support/docview.wss?rs=0&uid=swg21104835

Which sujjest following code:

Sub Initialize

Dim doc As NotesDocument

Dim item As Variant

Dim nitem As Variant

Dim rtitem As Variant

Dim uidoc As notesuidocument

Dim w As New notesuiworkspace

Set uidoc=w.currentdocument

Set doc = uidoc.document

Forall i In doc.Items

If i.type = Attachment Then

Set emb = doc.GetAttachment(i.values(0))

{

"I get an error here ( I am using this code in VB) with an error

“Property let procedure not defined and property get procedure did not return an object”

}

Set rtitem=doc.getfirstitem(“RTF”)

Call emb.extractfile("C:" & emb.name)

Call rtitem.embedobject(EMBED_Attachment, “”, "C:" & emb.name, emb.name)

Kill "C:" & emb.name

Call emb.remove

Call doc.save(1,1)

’ If one is only searching for one attachment then remove the remark from the line below

’ Exit Forall

End If

End Forall

End Sub

Can anyone sujjest what I am doing wrong?

Subject: RE: HasEmbedded True but getEmbedded returns nothing

Just for the record(i don’t know if you already solve your problem)…

You have in your code:

Forall i In doc.Items

If i.type = Attachment Then

Set emb = doc.GetAttachment(i.values(0)) "I get an error here ( I am using this code in VB) with an error

try to do this

Forall i In doc.Items

If i.type = 1084 Then

Set emb = doc.GetAttachment(i.values(0)) "I get an error here ( I am using this code in VB) with an error

1084 = Attachment

Antero Santos

antero.santos@armsi.com

Subject: HasEmbedded True but getEmbedded returns nothing

How are you trying to actually get a handle on the attachment(s) in question?

“GetEmbeddedObject” is a method you call on a NotesRichTextItem object, not a NotesDocument. The equivalent method for a document is “GetAttachment” (not the same).

You have to extract so-called “v2-style” attachments from the NotesDocument containing them, rather than the more usual NotesRichTextItem object. This is because these attachments are in the document itself, rather than within a rich text field in the document.

HTH

Subject: RE: HasEmbedded True but getEmbedded returns nothing

Hi,Thank you very much for the reply.

While going through all these froum I found that this attachemnt is V2-Style attachment ( most probaby created using web browser… though not sure…in 6.0 version…I have 5.2 version of notes client)

This attachment is not part of RichText Body but it is outside it …i donno how attached to the document.

When i use the code…

        Set rtitem = domShowDocument.GetFirstItem("Body")

                        If domShowDocument.HasEmbedded Then

                            If rtitem.Type = RICHTEXT Then

                               For Each embObj In rtitem.EmbeddedObjects

                                   

                              Here I get error TypeMismatch and get embobj as nothing

                                

                               next  embObj 

                ....

                 .....

When I look into the lotus client to see how this document looks …it has attachments (which we understand from the value when we get domShowDocument.HasEmbedded = true

but it has different kind of icon and it is definately outside the body part.

When I use

set embobj = domShowDocument.GetFirstItem(“$File”) I do get this object (where embobj is type object in definition)

but I donno How to extract this file because when i get embobj from the BODY part i can use embObj.ExtractFile method on it but when i get this object from GetFirstitem(“$File”) I do not get the method embObj.ExtractFile.

plus with this GetFirstItem(“$File”) if i look for .Values it returns empty objects though it does have attachments.