If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Your solution in in the NotesViewEntryCollection class using the PutInFolder Method.
You can cut and paste this code but suggest you add some print statements so you can see it run. If your mailbox has 10k messages like mine it will take a bit to run!
Good luck – Mike
*************************
%REM
This code will read your inbox and dump half its entries into a folder called “Cheese”.
%END REM
Sub Initialize
Dim s As New notessession
Dim db As notesdatabase
Dim v As notesview
Dim vec1 As notesviewentrycollection
Dim vec2 As notesviewentrycollection
Dim ve As notesviewentry
Set db = s.currentdatabase
Set v = db.GetView(“($Inbox)”)
count% = v.entrycount
%REM
this will get about half your inbox,
you can figure out how to get exactly 3000 if that’s what you want,
count the view to make sure you have at least that many entries and
then use the GetLastEntry method and work backwards to get your collection
%ENDREM
If count% Mod 2 = 0 Then
n& = count%/2
Else
n& = (count% – 1)/2
End If
Messagebox Str(n&)
Set vec1 = v.AllEntries
Set ve = vec1.GetNthEntry(n&)
While Not ve Is Nothing
n& = n& + 1
If n& > count% Then Goto finito ‘ this avoids the out of range error at the end of the loop
Call vec2.AddEntry(ve)
Set ve = vec1.GetNthEntry(n&)
Wend
finito:
Call vec2.PutAllInFolder(“Cheese”)
End Sub
Your solution in in the NotesViewEntryCollection class using the PutInFolder Method.
You can cut and paste this code but suggest you add some print statements so you can see it run. If your mailbox has 10k messages like mine it will take a bit to run!
Good luck – Mike
*************************
%REM
This code will read your inbox and dump half its entries into a folder called “Cheese”.
%END REM
Sub Initialize
Dim s As New notessession
Dim db As notesdatabase
Dim v As notesview
Dim vec1 As notesviewentrycollection
Dim vec2 As notesviewentrycollection
Dim ve As notesviewentry
Set db = s.currentdatabase
Set v = db.GetView(“($Inbox)”)
count% = v.entrycount
%REM
this will get about half your inbox,
you can figure out how to get exactly 3000 if that’s what you want,
count the view to make sure you have at least that many entries and
then use the GetLastEntry method and work backwards to get your collection
%ENDREM
If count% Mod 2 = 0 Then
n& = count%/2
Else
n& = (count% – 1)/2
End If
Messagebox Str(n&)
Set vec1 = v.AllEntries
Set ve = vec1.GetNthEntry(n&)
While Not ve Is Nothing
n& = n& + 1
If n& > count% Then Goto finito ‘ this avoids the out of range error at the end of the loop
Call vec2.AddEntry(ve)
Set ve = vec1.GetNthEntry(n&)
Wend
finito:
Call vec2.PutAllInFolder(“Cheese”)
End Sub