Domino 9 und frühere Versionen > ND6: Entwicklung

Fenster schließen im workspace

(1/3) > >>

Alexis:
Folgende Problematik:

Im PostOpen einer Maske analysiere ich einen DocLink, um aus dem verlinkten Dokument ein Attachment zu exportieren.
Das klappt so weit gut.

ABER: Beim "getDocumentByUNID" wird mir auch die Dokumentenmaske mit dem Attachment im Workspace geöffnet!

Genau dieses möchte ich vermeiden, weiss aber nicht wie.

Hat jemand einen Rat?

Alexis

ata:
... hast du einen Auszug aus deinem Code...

Toni

Thomas Schulte:
Zum öffnen musst du irgendwo noch ein wksp.editdocument drin haben. Sonst macht Script da nämlich gar nichts auf.

koehlerbv:
GetDocumentByUNID ist eine Methode der NotesDocument class, also Backend, ergo wird DADURCH auch nichts im FrontEnd passieren.

Ich schliesse mich daher Toni an.

Bernhard

Alexis:
Hallo,

hier mein Code:

--- Code: ---Sub Postopen(Source As Notesuidocument)
Dim session As New NotesSession
Dim rti As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtlink As NotesRichTextDocLink
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument

Set doc = source.Document
If doc.IsNewNote Or source.EditMode Then Exit Sub

Set rti = doc.GetFirstItem("Link")
Set rtnav = rti.CreateNavigator

If Not rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
Messagebox "No doclinks in Link item",, "No doclinks"
Else
Set rtlink = rtnav.GetElement
End If

Call doc.Save(False,False)
Dim doc2 As NotesDocument
Dim db2 As New NotesDatabase( "", "" )
If Not db2.OpenByReplicaID( "ServerName", rtlink.DbReplicaID ) Then Messagebox "Unable to open database"

Set doc2 = db2.getDocumentByUNID(rtlink.DocUNID)
Set rtitem = doc2.GetFirstItem( "Body_1" )
If rtitem Is Nothing Then
Messagebox "No attachment available"
Else
Dim file As String
Forall all In rtitem.EmbeddedObjects
If ( all.Type = EMBED_ATTACHMENT ) Then
file = Join(Split("c:\" & all.Name, " "), "")
Call all.ExtractFile (File)
taskid = Shell("cmd.exe /c start " + file , 0)
End If
End Forall
End If

End Sub
--- Ende Code ---

Alexis

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln