![]() |
Rule Category Conditions Query
Can't seem to get this to work... or get my head round the methods/properties
to get it right... I've tried using the Object Explorer and even installed OutlookSpy but being a relative beginner with no formal training in Object Orientated Code I'm just getting a headache !! Can anyone help put me on the straight & narrow... it would be much appreciated - thanks Dim colRules As Outlook.Rules Dim oRule As Outlook.Rule Dim colRuleActions As Outlook.RuleActions Dim oFromCondition As Outlook.ToOrFromRuleCondition Dim oCategoryCondition As Outlook.CategoryRuleCondition Dim oInbox As Outlook.Folder Dim oMoveTarget As Outlook.Folder Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox ) Set oMoveTarget = oInbox.Folders(Foldername) Set colRules = Application.Session.DefaultStore.GetRules() Set oRule = colRules.Create(Rulename, olRuleReceive) Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With oRule.Enabled = False colRules.Save All works fine if I comment out the category condition code - rule gets setup but as soon as I throw the category condition in ie. Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With it fails... Any help appreciated - thx |
Rule Category Conditions Query
oCategoryCondition.Categories takes/returns a string array, it's not a
collection. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Jabba1963" wrote in message ... Can't seem to get this to work... or get my head round the methods/properties to get it right... I've tried using the Object Explorer and even installed OutlookSpy but being a relative beginner with no formal training in Object Orientated Code I'm just getting a headache !! Can anyone help put me on the straight & narrow... it would be much appreciated - thanks Dim colRules As Outlook.Rules Dim oRule As Outlook.Rule Dim colRuleActions As Outlook.RuleActions Dim oFromCondition As Outlook.ToOrFromRuleCondition Dim oCategoryCondition As Outlook.CategoryRuleCondition Dim oInbox As Outlook.Folder Dim oMoveTarget As Outlook.Folder Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox ) Set oMoveTarget = oInbox.Folders(Foldername) Set colRules = Application.Session.DefaultStore.GetRules() Set oRule = colRules.Create(Rulename, olRuleReceive) Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With oRule.Enabled = False colRules.Save All works fine if I comment out the category condition code - rule gets setup but as soon as I throw the category condition in ie. Set oCategoryCondition = oRule.Conditions.Category With oCategoryCondition.Categories .Categories.Add (CategoryName) End With it fails... Any help appreciated - thx |
All times are GMT +1. The time now is 11:36 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com