LotusScript COM: Open NotesDocument in UI

I am working on coexistence between Microsoft Outlook and IBM Lotus Notes.

Outlook Items = Notes Documents

I am adding context menu’s in Outlook where a user clicks any Item in MS Outlook would display a “Open Document” option. I have everything working to the point where I need to display the document in Lotus Notes.

I can open Notes databases through COM, got to a view and highlight a document. But I cannot figure out a way to open the document through COM.

The code below shows how I’m doing this and it errors out at NotesUIWorkspace.EditDocument(LNdoc) line.

I tried returning to a NotesUIDocument, that errors out, I tried all combinations of input parameters to EditDocument(boolvalue, doc, boolvalue).

Is there an alternative solution to open a document through com?

Public Sub OpenLNDatabase(servername As String, dbname As String, docID As String, docKey As String)

Dim ws As Object '(NotesUIWorkSpace)

Dim cLotusNotes As New clsLotusNotes

Dim LNDb As NotesDatabase

Dim LNdoc as NotesDocument

Dim LNSession as new NotesSession



If (servername = "" Or dbname = "") Then

    MsgBox "I am not configured to open this Lotus Notes database.  Please contact support", vbCritical, Title

    Exit Sub

End If



Set LNSession = New NotesSession

Call cLotusNotes.session.Initialize

                  

Set ws = CreateObject("Notes.NotesUIWorkspace")



Set LNDb = LNSession.GetDatabase(servername, dbname)

   

If (docID = "" And docKey = "") Then

'THIS WORKS

    Call ws.OpenDatabase(servername, dbname, "", "", "")

Else

    'open document in database by docuid

    If (docID <> "") Then

    Set LNDoc = LNDb.GetDocumentByUNID(docID) 'works

    Call ws.EDITDOCUMENT(LNDoc) 'automation error



   Else

        If (docKey <> "") Then

        'search a view for a field value

        'to get a handle to a notesdocument.

        End If

    End If

    

End If



Set ws = Nothing

End Sub

Subject: Use NotesURL

Hi Steve

Have you considered using

LNDoc.NotesURL & “?EditDocument”

and launching that ? It should do the same thing.

kind regards

Simon Delicata