I am trying to call the prompt method on NOTESUIWORKSPACE using ole, but I get an error message “Incorrect argument type: integer expected”. Here is the definition of the function from the ole viewer
[id(0x0000073d)]
VARIANT PROMPT(
[in] short TYPE,
[in] VARIANT TITLE,
[in] VARIANT PROMPT,
[optional] VARIANT DEFAULT,
[optional] VARIANT VALUES);
and here is my code. I have tried all sorts of things, but nothing seems to be helping. Please help:
Dim NotesSession As Object = Nothing
Dim NotesDb As Object = Nothing
Dim NotesUIDb As Object = Nothing
Dim NotesUIVw As Object = Nothing
Dim NotesDoc As Object = Nothing
Dim NotesWorkspace As Object = Nothing
Dim NotesDocumentColl As Object = Nothing
Dim NotesArchiveDb As Object = Nothing
Dim CopyDocParams() As Object = {""}
Dim i As Integer
'get notes session
Dim NotesSessionType As System.Type = System.Type.GetTypeFromProgID("Notes.NotesSession")
NotesSession = System.Activator.CreateInstance(NotesSessionType)
'get the user notes database
If (Not (NotesSession) Is Nothing) Then
NotesDb = Microsoft.VisualBasic.Interaction.CallByName(NotesSession, "CURRENTDATABASE", Microsoft.VisualBasic.CallType.Get)
NotesArchiveDb = NotesSession.GetDatabase("", "try")
If (Not (NotesDb) Is Nothing) Then
'create a NotesUIWorkspace
Dim NotesWorkspaceType As System.Type = System.Type.GetTypeFromProgID("Notes.NotesUIWorkspace")
NotesWorkspace = System.Activator.CreateInstance(NotesWorkspaceType)
If (Not (NotesWorkspace) Is Nothing) Then
Dim values() As Object = {1, 2, 3}
Dim selection As Object = Nothing
Dim wsParams() As Object = {1, "Title", "Message"}
' The code blows up trying to execute the following line
selection = Microsoft.VisualBasic.Interaction.CallByName(NotesWorkspace, "PROMPT", Microsoft.VisualBasic.CallType.Get, wsParams)
NotesUIVw = Microsoft.VisualBasic.Interaction.CallByName(NotesWorkspace, "CurrentView", Microsoft.VisualBasic.CallType.Get)
NotesDocumentColl = Microsoft.VisualBasic.Interaction.CallByName(NotesUIVw, "Documents", CallType.Get)
If (Not (NotesDocumentColl) Is Nothing) Then
NotesDoc = Microsoft.VisualBasic.Interaction.CallByName(NotesDocumentColl, "GetFirstDocument", CallType.Get)
For i = 1 To NotesDocumentColl.Count
CopyDocParams(0) = i
NotesDoc = NotesDocumentColl.GetNthDocument(i)
CopyDocParams(0) = NotesArchiveDb
Microsoft.VisualBasic.Interaction.CallByName(NotesDoc, "CopyToDatabase", CallType.Method, CopyDocParams)
Next
MsgBox(i - 1 & " documents processed")
'Microsoft.VisualBasic.Interaction.CallByName(NotesWorkspace, "RELOADWINDOW", Microsoft.VisualBasic.CallType.Method)
'Microsoft.VisualBasic.Interaction.CallByName(NotesWorkspace, "ViewRefresh", CallType.Method)
'While Not (NotesDoc Is Nothing)
' NotesDoc = NotesDocumentColl.GetNextDocument()
' Microsoft.VisualBasic.Interaction.CallByName(NotesDoc, "CopyToDatabase", CallType.Method, CopyDocParams)
'End While
End If
NotesSession = Nothing
NotesDb = Nothing
NotesDoc = Nothing
NotesWorkspace = Nothing
End If
End If
End If
End Sub