Redemption - Rules for outlook

  • Thread starter Christopher Long
  • Start date
Status
Not open for further replies.
C

Christopher Long

Afternoon. Think i may have placed the last post in the wrong newsgroup so

please excuse the double post.

I have been using the redemption dll as of late in order to programatically

created a bunch of rules to filter emails (around 144 rules though this could

be more or less) based on items in a csv file.

All is good except for 1 little issue i just can't get myself past after a

few days of googling and trial and error. Below is a listing of code that

causes an error after around 49 rules with associated objects are created on

my system.

I've followed the posting and google results on the RPC limits and

marshaling to release objects and i'm sure thats the problem. I get a mixture

of errors mostly MAPI_E_NOT_ENOUGH_MEMORY and MAPI_E_CALLBACK (i think thats

it).

Works wonderfully for less than 49 objects but obviously would be better if

i could fix it. Can someone try the below code / offer some suggestions on

how to correctly release all explicit and implict objects and vars that might

be causing the problems? I'd be most appreciative. Was good seeing the light

at the end of the tunnel till i realised it was a train :/ at which point it

was too late.

Public Inbox As Redemption.RDOFolder

Public MainInbox As Redemption.RDOFolder

MainInbox = Store.GetDefaultFolder(DefaultInboxFolder.olFolderInbox)

Inbox = MainInbox.Folders(txtFolderName.Text)

Code:
Dim i As Integer 
 
Dim strTestArray() As String 
 
'temp test 
 
Dim rule As Redemption.RDORule 
 
Dim action As Redemption.RDORuleAction 
 
Dim actions As Redemption.RDORuleActions 
 
Dim subfolder As Redemption.RDOFolder 
 
Dim strConditions As String 
 
Debug.Listeners.Add(New 
 
TextWriterTraceListener(System.AppDomain.CurrentDomain.BaseDirectory() & 
 
"output.txt")) 
 
Debug.AutoFlush = True 
 
strConditions = "(SenderEmailAddress = 'test@test.com') and (Body 
 
like '%test%')" 
 
subfolder = Inbox.Folders("Test") 
 
For i = 1 To 100 
 
ReDim strTestArray(2) 
 
strTestArray(0) = "testrule" & i 
 
strTestArray(1) = "Test" 
 
strTestArray(2) = "Test" 
 
' begin temp 
 
rule = rules.Create(strTestArray(0)) 
 
'            subfolder = Inbox.Folders("Test") 
 
actions = rule.Actions 
 
action = actions.MoveToFolder 
 
action.Folder = subfolder 
 
action.Enabled = True 
 
rule.ConditionsAsSQL = strConditions 
 
rule.Enabled = True 
 
rule.Save() 
 
Marshal.ReleaseComObject(action) 
 
Marshal.ReleaseComObject(actions) 
 
Marshal.ReleaseComObject(rule) 
 
GC.Collect() 
 
' end temp 
 
Debug.WriteLine(i) 
 
Next i 
 
MsgBox("test finished - " & i)
 
See my answer in the other group.

"Christopher Long" <ChristopherLong> wrote in

message news:376753A0-A049-4322-8CAD-ADD8CA40EB07@microsoft.com...
> Afternoon. Think i may have placed the last post in the wrong newsgroup so
> please excuse the double post.

> I have been using the redemption dll as of late in order to
> programatically
> created a bunch of rules to filter emails (around 144 rules though this
> could
> be more or less) based on items in a csv file.

> All is good except for 1 little issue i just can't get myself past after a
> few days of googling and trial and error. Below is a listing of code that
> causes an error after around 49 rules with associated objects are created
> on
> my system.

> I've followed the posting and google results on the RPC limits and
> marshaling to release objects and i'm sure thats the problem. I get a
> mixture
> of errors mostly MAPI_E_NOT_ENOUGH_MEMORY and MAPI_E_CALLBACK (i think
> thats
> it).

> Works wonderfully for less than 49 objects but obviously would be better
> if
> i could fix it. Can someone try the below code / offer some suggestions on
> how to correctly release all explicit and implict objects and vars that
> might
> be causing the problems? I'd be most appreciative. Was good seeing the
> light
> at the end of the tunnel till i realised it was a train :/ at which point
> it
> was too late.

> Public Inbox As Redemption.RDOFolder
> Public MainInbox As Redemption.RDOFolder

> MainInbox =
> Store.GetDefaultFolder(DefaultInboxFolder.olFolderInbox)
> Inbox = MainInbox.Folders(txtFolderName.Text)

>
Code:
>         Dim i As Integer 
>         Dim strTestArray() As String 
 
>         'temp test 
>         Dim rule As Redemption.RDORule 
>         Dim action As Redemption.RDORuleAction 
>         Dim actions As Redemption.RDORuleActions 
>         Dim subfolder As Redemption.RDOFolder 
>         Dim strConditions As String 
 
>         Debug.Listeners.Add(New 
>  TextWriterTraceListener(System.AppDomain.CurrentDomain.BaseDirectory() & 
>  "output.txt")) 
>         Debug.AutoFlush = True 
 
>         strConditions = "(SenderEmailAddress = 'test@test.com') and (Body 
>  like '%test%')" 
 
>         subfolder = Inbox.Folders("Test") 
 
>         For i = 1 To 100 
>             ReDim strTestArray(2) 
>             strTestArray(0) = "testrule" & i 
>             strTestArray(1) = "Test" 
>             strTestArray(2) = "Test" 
 
>             ' begin temp 
>             rule = rules.Create(strTestArray(0)) 
>             '            subfolder = Inbox.Folders("Test") 
 
>             actions = rule.Actions 
>             action = actions.MoveToFolder 
>             action.Folder = subfolder 
>             action.Enabled = True 
 
>             rule.ConditionsAsSQL = strConditions 
 
>             rule.Enabled = True 
>             rule.Save() 
 
>             Marshal.ReleaseComObject(action) 
>             Marshal.ReleaseComObject(actions) 
>             Marshal.ReleaseComObject(rule) 
 
>             GC.Collect() 
>             ' end temp 
 
>             Debug.WriteLine(i) 
 
>         Next i 
 
>         MsgBox("test finished - " & i) 
 
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
N Redemption VBA basics...something's missing Using Outlook 0
D Redemption? Need rapid pull of Outlook Contacts, email + notes for VBA Using Outlook 1
J 64-bit version of Redemption? Outlook VBA and Custom Forms 2
E Redemption access AppointmentItem Label from outlook Outlook VBA and Custom Forms 6
E Redemption MAPI access(c#) Outlook VBA and Custom Forms 4
W Redemption::RDOMail.PrintOut() / DoAction(maPrint) not working Outlook VBA and Custom Forms 1
B Use Redemption to get sender's email address Outlook VBA and Custom Forms 3
M EMail1Address and EMail1AddressType strangeness using Redemption Outlook VBA and Custom Forms 2
A Creating Redemption.MAPIUtils failed with Windows 7 x64 Outlook VBA and Custom Forms 5
D href tags does not result in the full url with Redemption Outlook VBA and Custom Forms 4
E Redemption Foldes.Add doesn't work Outlook VBA and Custom Forms 3
E Redemption Foldes.Add doesn't work Outlook VBA and Custom Forms 3
N Redemption.RDOSession logon() stops emails sending-they stay in Ou Outlook VBA and Custom Forms 3
E Should I switch to redemption Outlook VBA and Custom Forms 11
E Should I switch to redemption Outlook VBA and Custom Forms 11
G Error in Outlook Object Model with redemption and google apps prem Outlook VBA and Custom Forms 3
P Redemption Send EMail Outlook VBA and Custom Forms 10
S redemption reference Outlook VBA and Custom Forms 1
T Configure mailbox OutofOffice with Redemption Outlook Outlook VBA and Custom Forms 1
D redemption dll not registering in windows vista Outlook VBA and Custom Forms 3
Y Redemption MessageItem SaveAs problem Outlook VBA and Custom Forms 8
R Newbie Redemption ISafeMailItemPtr question Outlook VBA and Custom Forms 6
Q GAL.ResolveName issue with REDEMPTION Outlook VBA and Custom Forms 5
Q REDEMPTION HANGING during LOGON Outlook VBA and Custom Forms 2
P Redemption not working on OL2007 Outlook VBA and Custom Forms 2
P Redemption Send EMail fails Outlook VBA and Custom Forms 4
S delete appointmentitem permanently using redemption Outlook VBA and Custom Forms 2
D redemption - foldercreate event + delegate user Outlook VBA and Custom Forms 8
C Assign To and CC list while using Redemption.dll library Outlook VBA and Custom Forms 10
U Re: Read fields with Redemption Outlook VBA and Custom Forms 1
V redemption MAPIUtils Outlook VBA and Custom Forms 3
R How to simplify rules Using Outlook 2
J Recover server side rules from OST/PST without access to the server Using Outlook 2
J Outlook Rules VBA Run a Script - Multiple Rules Outlook VBA and Custom Forms 0
N Outlook 2021 'Run Script" Rules? Outlook VBA and Custom Forms 4
K Multiple Rules on Single Email Using Outlook 2
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
R rules not working - done troubleshooting Using Outlook 0
P Outlook 2013 All imported Mail Rules in error when imported into new profile Using Outlook 5
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
Wayne Outlook locks up when opening "Manage Rules & Alerts" Using Outlook 7
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
Retired Geek Junk Folder Clean Up Rules Exchange Server Administration 1
B Setting rules Using Outlook 1
A rules not working Using Outlook 2
M Rules and autoreply Using Outlook 1
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
O How to recover rules after switch from POP3 to IMAP Using Outlook 2
N Focussed Inbox Rules Failing Using Outlook 5

Similar threads

Back
Top