hi,
I have a little challenge. I have an embeded view that contains documents that have pdf, tif, doc files attached to them one attachment per document, I need to be able to open the attachment in the document from that embeded view. In order to select a document I enabled “Show Selection MArgin” from the embedded view properties, and I have a button on the form thta should just launch the attachement from the selected document. But I cant get a hold on the document, I’m kind of stuck here.
help please…
thanks
Subject: Attachemnt
Hi,
Did you try the code:
dim s as new notessession
dim dc as notesdocumencollection
set dc = s.currentdatabase.unprocesseddocuments
this DC should contain the selected document(s)
?
Subject: RE: Attachemnt
Hi,
I used
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim dc As NotesDocumentCollection
Dim cdoc As NotesDocument
Set uiview = ws.CurrentView
Set dc = uiview.Documents
Set cdoc = dc.GetFirstDocument
this now gets me the selected document. but the triky part is opening the attachment is that document form a button… the button is a view action, that is where the above code is. but now that I have the document how can I open the attachment it has in the “Body”
Subject: RE: Attachemnt
I think the next code should help you runnig the attachement:
dim ritm as Variant
dim EmbeddedObjectsArray as notesEmbeddedObject
set ritm = cdoc.GetFirstItem( “Body” )
set EmbeddedObjectsArray = ritm.EmbeddedObjects 'Returns an array
EmbeddedObjectsArray(0).Activate( True )
Please see the LN Design help (NotesEmbeddedObject) for another way to do this.
Regards,
Mohammed.
Subject: RE: Attachemnt
Sorry, next line shoul be:dim EmbeddedObjectsArray as Variant
Subject: RE: Attachemnt
thanks so much for your help…my code now looks like this
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim dc As NotesDocumentCollection
Dim cdoc As NotesDocument
Set uiview = ws.CurrentView
Set dc = uiview.Documents
Set cdoc = dc.GetFirstDocument
Msgbox(cdoc.IENContact(0))
Dim ritm As Variant
Dim EmbeddedObjectsArray As Variant
Set ritm = cdoc.GetFirstItem( "Body" )
Set EmbeddedObjectsArray = ritm.EmbeddedObjects 'Returns an array
EmbeddedObjectsArray(0).Activate( True )
End Sub
but I get “Type Mismatch”
Subject: RE: Attachemnt
next code does the same: Dim ritm As Variant
Dim EmbeddedObjectsArray As Variant
Set ritm = cdoc.GetFirstItem( "DocumentationAttachement" )
'Set EmbeddedObjectsArray = ritm.EmbeddedObjects 'Returns an array
Forall o In ritm.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.Activate(True)
’ Call o.ExtractFile( "c:\samples" & o.Source )
’ Call o.Remove
’ Call doc.Save( False, True )
End If
End Forall
Next thing you can do is to turn on the option (in form property box) “Auto Launch”: First Attachement. To Avoid the form to allways do this, you can create a new form and put the form name in the “Form Formula” of you embedded view. In this way you have one form to auto launch the attachement and one form to edit the documents containing the attachements.
Greetz,
Mohammed.