I'm using the Domino .NET wrapper classes to allow users to drag an email from their Lotus inbox to a winform.
I'm getting a data object back, that contains notes URL to the document, in the form
notes://server/replicaID/viewID/documentUNID
And passing it to Domino.NotesSession.Resolve(pUrl) which is supposed to return the matching document. Actually, pasting the link in my browser (replacing notes:// by http:// works like a charm, I get the HTML version of the email) works.
But the Resolve method keeps on returning what seems to be a NotesView, not the actual document :
Dim notesSession as Domino.NotesSession = ' ... Initialize session here
Dim notesURL as string = "notes://server/replicaID/viewId/documentID"
Dim draggedDocument = notesSession.Resolve(notesURL)
' Here, I do get an actual document, but its UnID matches the viewId
' part of the url, not the document.
I tried removing the viewID from the URL, but with no more success. The only way I found to successfully retrieve the document is by using the OLE objects (lotus namespace) :
' Get UnId from url
Dim unid as String = notesURL.Split("/").Last()
' Get UI Automation object
Dim workspace = CreateObject("Notes.NotesUIWorkspace")
' Get currently open DB (the where the drag event was initiated)
Dim notesDb = workspace.CURRENTDATABASE.Database
' Retrieve matching document
Dim notesDoc = notesDb.GetDocumentByUNID(unid)
While this method works, I don't want to use the UI automation classes (OLE), but Domino's COM wrapper (.NET).
So how do exactly these notes URLs work in interop ? Is there any way I can retrieve the matching document without knowing the database first hand ? Why does the Resolve method return a view object when given a document URL ?
Any help welcome.