I have read a lot of posts and did a lot of searching and so far it does not seem like there is a clear cut answer for this. I am trying to reprpoduce the following Formula Langauge as LS:
I then need to be able to take the message that is selected and copy (or move) it into the current DB.
This is what I have in LS so far:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim collection As NotesDocumentCollection
Dim MailDb As Variant
Dim folder As String
Dim I As Integer
MailDb=Evaluate(|@MailDbName|)
'get folder list
Set collection=workspace.PickListCollection(PICIKLIST_CUSTOM, True, MailDb(0), MailDb(1), folder, "Copy Mail", "Select mail to copy:")
If Collection.Count>O Then
For I=1 To SrcCal.Count
’ Copy Message
Next
End If
End Sub
In LS I know I can do the copying if I use a Collection. My problem is that I cannot find a way to do the first picklist abova in LS. I need to know the folder prior to calling PickListCollection.
My other thought is to do a collection in Formula langage but I don’t think that is available.
'* read views in maildatabase
'*-------------------------------------------
nView = 0
Forall v In dbMail.Views
If nView = 0 Then
Redim vList (0)
Else
Redim Preserve vList (nView)
End If
'* exclude systemviews
'*-------------------------------------------------
If Instr (1, v.Name, "$") = 0 Then
vList (nView) = v.Name
nView = nView + 1
End If
End Forall
'* optional sort
'*-----------------------------
Call QuickSort (vList, Lbound (vList), Ubound (vList))
'* build a select form (one input field)
'*--------------------------------------------
Set docTmp = New NotesDocument (dbCurrent)
docTmp.Form = pMaske
docTmp.HTDbViews = vList
'* get value from the form
'*------------------------
If ws.DialogBox (pMaske$,True,True,False,False,False,False,pTitle$,docTmp) Then
If docTmp.dbViews (0) <> "" Then
pSource = docTmp.dbViews (0)
pHinweis = "Auswahl Mail für Übernahme aus " & pSource
Else
Exit Sub
End If
Else
Exit Sub
End If
Well I guess I should have thought about this for a few more minutes. I have come up with a solution. I used an environment variable to store the folder name and then read it from an agent.
If anyone has a better or cleaner method, I would be interested.
Here is what I have:
:: Formula
db:=@MailDbName;
fldr:=@PickList([Folders] : [Single] ; db);
@Environment( “ENVFolder” ; fldr );
@Command([ToolsRunMacro];“(CopyMessage)”)
:: Agent
Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim collection As NotesDocumentCollection
Dim session As New NotesSession
Dim MailDb As Variant
Dim folder As String
Dim I As Integer
Dim doc As NotesDocument
Dim Newdoc As NotesDocument
Dim db As NotesDatabase
Set db = session.CurrentDatabase
MailDb=Evaluate(|@MailDbName|)
folder = session.GetEnvironmentString( "ENVFolder" )
Set collection=workspace.PickListCollection(PICIKLIST_CUSTOM, True, MailDb(0), MailDb(1), folder, "Copy Mail", "Select mail to copy:")
If collection.Count>0 Then
For I=1 To collection.Count
’ Copy Message
Set doc = collection.GetNthDocument(I)
Set Newdoc = db.CreateDocument
Call doc.CopyAllItems(Newdoc,True)
Call Newdoc.Save( True, True )
Next
End If