One of today's challenges has been to find a way for a form to get access to the list of documents selected in an embedded view. After searching high and low I finally found some code written by Julian Robichaux that came very close to providing what I wanted (thanks Julian). So the DominoView class in the .Domino Framework has now been extended with a SelectedDocuments property that returns a NotesDocumentCollection containing the documents selected for that view in the NotuesUIWorkspace. I imagine this can be anywhere on the workspace and not just an embedded view!
e.g.
Dim myview as New DominoView("myembeddedviewname"
Dim DocList As NotesDocumentCollection
Set DocList = myview.SelectedDocuments
.....
The core code in the property is as follows (Note: some bits of code are provided by the framework)
Property Get SelectedDocuments As NotesDocumentCollection
Dim hDb As Long
Dim viewNoteID As Long
Dim hCollection As Long
Dim hIDTable As Long
Dim PathName As String*256
Dim NoteID As Long
Dim FirstFlag As Integer
Dim Result As Integer
Dim Count As Long
Dim NID As String
Dim Collection As NotesDocumentCollection
Dim Doc As NotesDocument
Try:
On Error Goto Catch
If iView Is Nothing Then Exit Property
' Get Collection of selected documents
Call OSPathNetConstruct(0, DB.Server, DB.FilePath, PathName$) ' Create a proper network path name with OSPathNetConstruct
Result = NSFDbOpen(pathName, hDb) ' Open the database and get a handle with NSFDbOpen
If Result <> 0 Then Exit Property
Call OSPathNetConstruct(0, DB.Server$, DB.FilePath$, PathName$) ' Create a proper network path name with OSPathNetConstruct
Result = NSFDbOpen(PathName$, hDb) ' Open the database and get a handle with NSFDbOpen
If Result <> 0 Then Exit Property
Result = NIFOpenCollection(hDB, hDB, ViewNoteID, 0, 0, hCollection, 0, 0, 0, hIDTable) ' Get the ID table of all the selected docs in the view
If Result <> 0 Then Goto Finally
Count& = IDEntries(hIDTable)
If (Count& = 0) Then Goto Finally
' Convert collection to NotesDocumentCollection
Set Collection = Application.EmptyNotesDocumentCollection
FirstFlag = True
Do While IDScan(hIDTable&, FirstFlag%, NoteID&
> 0