GetAttachment method

Hello,I directly attached a file in a form using “create attachment” option of designer;

I tried without luck to manage this file:

I noted that is not possible to edit this file in a document (only view or open); moreover, when I try to manage this attachment using “GetAttachment” method, I found that the related object is “empty”:

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = workspace.CurrentDocument

Dim doc As NotesDocument

Dim object As NotesEmbeddedObject

Set doc=uidoc.document

Set object = doc.GetAttachment( “uno.xls” )

If ( object Is Nothing ) Then

Msgbox “null”

Else

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

End If

And obviously I see the msgbox…

Thank You in advance for any help,

Dave

Subject: GetAttachment method

Try calling the following statement just after setting the uidoc.

Call uidoc.Refresh( true )

Hope this helps.

Regards,

Nitin

Subject: RE: GetAttachment method

Thank you for your prompt reply!

I followed your suggestion, but unfortunately without success, the object is always “empty”…

Dave

Subject: RE: GetAttachment method

Probably try saving the document and then check in document properties… $File field that whether the said file name is listed in the field or not.

Moreover you can try using

'>>

call uidoc.Refresh(true)

If doc.HasEmbedded Then

Forall gdObjects In doc.EmbeddedObjects

print gdObjects.Name

End Forall

Else

Print “No attachments in the doc”

End if

'>>

Subject: RE: GetAttachment method

Hi,I think that this is the problem:

$File is not present in the field list;

so, it seems that it is not possible to manage an attachment added directly from designer…

Thank You

Dave

Subject: GetAttachment method

you’ve attached it to the form, so it’s displayed when viewing documents with this form, but not allowing you to edit it, which i think is most reasonable, because you don’t want a user do manipulate anything in db-design:)

i’ve never done anything like that, but a quick (maybe dirty) workaround would be to get design notes note-id and get attachment from there. sounds bit strange but should work.

Markus Seitz

markus.seitz@icodex.com