AutoHotkey Community

It is currently May 27th, 2012, 9:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: September 13th, 2011, 2:20 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
This thread is an ongoing project to document all of Microsoft Office Outlook's properties and methods as a reference for future Ahk scripters.
I wanted to learn more about COM in general and more specifically for Outlook. I figure the best way would be to read through the entire MSDN and code some examples so that I feel I truly understand how it works.

Any comments, examples, or flaws in this page please post below. Any examples given I will make sure to give credit to the author. :)

Below this will eventually be the index with reference numbers:
=========================================

Outlook Application Object Members References:
Application Object Members (Outlook) Office 2003
Application Object Members (Outlook) Office 2007
Application Object Members (Outlook) Office 2010
~Added by jethrow

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 13th, 2011, 8:49 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 2:20 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== Application Object ===
========================================================
~Represents the entire Outlook application.
Code:
Application := ComObjActive("Outlook.Application")
~You can use CreateItem directly from this object without traversing the entire hierarchy.

--------------------------------------------------------
=== Application Methods ===
--------------------------------------------------------
ActiveExplorer
~Returns the topmost Explorer object on the desktop.
~Returns nothing if no explorer is active.
Code:
ActiveExplorer := ComObjActive("Outlook.Application").ActiveExplorer

ActiveInspector
~Returns the topmost Inspector object on the desktop.
~Returns nothing if no inspector is active.
Code:
ActiveInspector := ComObjActive("Outlook.Application").ActiveInspector

ActiveWindow
~Returns the topmost Microsoft Outlook window which can be either an Explorer or Inspector object.
~Returns nothing if no explorer or inspector is open.
Code:
ActiveWindow := ComObjActive("Outlook.Application").ActiveWindow

AdvancedSearch
~Returns a Search Object.
~Use the Save Method to retain the search filter.

Application.AdvancedSearch(Scope, Filter, SearchSubFolders, Tag)
- Scope (Required): The folder path.
- Filter (Optional): The DASL filter that defines the parameters or the search.
- SearchSubFolders (Optional): also search sub folders.
- Tag: The name of the search for saving purposes.

CopyFile
Application.CopyFile(FilePath, DestFolderPath)
- FilePath (Required): The path of the file to copy.
- DestFolderPath (Required): Path of the location to copy to.
Code:
Path := "C:\Documents and Settings\" . A_UserName . "\Desktop\Book1.xls" ;create a blank workbook on your desktop
File := ComObjActive("Outlook.Application").CopyFile(Path, "Inbox")

CreateItem
Application.CreateItem(ItemType)
- ItemType (Required): The OlItemTypetype for the new item.
~This method can only create default items.
Code:
;example of creating a MailItem and setting it's format to HTML
olMailItem := 0
MailItem := ComObjActive("Outlook.Application").CreateItem(olMailItem)
olFormatHTML := 2
MailItem.BodyFormat := olFormatHTML
MailItem.HTMLBody := "<HTML><H2>The body of this message will appear in HTML.</H2><BODY> Please enter the message text here. </BODY></HTML>"
MailItem.Display

CreateItemFromTemplate
Application.CreateItem(TemplatePath, InFolder)
- TemplatePath (Required): The path and file name of the template.
- InFolder (Optional): The folder where the item will go. If empty will go to the default folder.
Code:
;create a template
olMailItem := 0
Item := ComObjActive("Outlook.Application").CreateItem(olMailItem)
Item.Subject := "Testing"
Item.To := "Myself"
Item.Display
Item.SaveAs("C:\Testing.oft") ;outlook may detect this action as a virus
;create new message with template
Item := Application.CreateItemFromTemplate("C:\Documents and Settings\" .  A_UserName . "\ApplicationData\Microsoft\Templates\Testing.oft")
Item.Display

CreateObject
~Creates an Automation object of the specified class.
Application.CreateObject(ObjectName)
- ObjectName (Required): The name of the object class to create.
Code:
IE := ComObjActive("Outlook.Application").CreateObject("InternetExplorer.Application")
IE.Visible := 1 ;true
IE.Navigate("www.microsoft.com")

GetNamespace
~Returns the NameSpace object of a certain type.
Application.GetNamespace(Type)
- Type (Required): "MAPI" is the only type supported.
Code:
NameSpace:= ComObjActive("Outlook.Application").GetNameSpace("MAPI")

GetObjectReference
~Creates a strong or weak object reference for a specified Outlook object.
Application.GetObjectReference(Item, ReferenceType)
- Item (Required): The object to reference.
- ReferenceType(Required): The object's type.
- olStrong := 1
- olWeak := 0
Code:
;Item := ?
Reference := ComObjActive("Outlook.Application").GetObjectReference(Item, 0)

IsSearchSynchronous
~Returns true or false indicating if a search will be synchronous or asynchronous.
~True if synchronous and false otherwise.
Application.IsSearchSynchronous(LookInFolders)
- LookInFolders (Required): The path to the folders to search. Enclose the path with single quotes.
Code:
Application := ComObjActive("Outlook.Application").IsSearchSynchronous("My Documents")

Quit
~Logs you completely out of Outlook.
Code:
Application := ComObjActive("Outlook.Application").Quit
;or
Application.Quit

--------------------------------------------------------
=== Application Properties ===
--------------------------------------------------------
Application
~Returns an Application object that represents the parent Outlook application.
Code:
Application := ComObjActive("Outlook.Application")
;or
Application := ComObjCreate("Outlook.Application")

Assistance
~Returns an Assistance object used to invoke help.
Code:
Application := ComObjActive("Outlook.Application")
Assistance := Application.Assistance

Class
~Returns an constant indicating the object's class.
Code:
Application := ComObjActive("Outlook.Application")
Class := Application.Class

COMAddIns
~Returns a COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Outlook.
Code:
MsgBox % "There are " . ComObjActive("Outlook.Application").COMAddIns.Count . " COM add ins."

DefaultProfileName
~Returns the default profile name.
Code:
MsgBox % "The default profile name is """ . ComObjActive("Outlook.Application").DefaultProfileName . """."

Explorers
~Returns a Explorers collection of all open Explorer objects.
Code:
MsgBox % "There are " . ComObjActive("Outlook.Application").Explorers.Count . " explorers in the collection."

Inspectors
~Returns a Inspectors collection of all open InspectorObjects.
Code:
Application := ComObjActive("Outlook.Application")
If (Application.Inspectors.Count = 0)
MsgBox, No Inspectors open.
Else {
Loop % Application.Inspectors.Count
Message .= Application.Inspectors.Item(A_Index).Caption . "`n"
MsgBox % Message
}

IsTrusted
~Returns True or False to indicate if an add-in or external caller is considered trusted.
Code:
If (ComObjActive("Outlook.Application").IsTrusted = 1)
MsgBox, The add-in or external caller is trusted
Else MsgBox, The add-in or external caller is not trusted

LanguageSettings
~Returns a LanguageSettingsobject for the application that contains the language-specific attributes of Outlook.
Code:
LanguageSettings := ComObjActive("Outlook.Application").LanguageSettings

Name
~Returns the display name for the object.
Code:
MsgBox % "The display name is " . ComObjActive("Outlook.Application").Name . "."

Parent
~Returns the parent Object of the specified object.
Code:
Parent := ComObjActive("Outlook.Application").Parent

ProductCode
~Returns a String specifying the Microsoft Outlook globally unique identifier (GUID).
Code:
ProductCode := ComObjActive("Outlook.Application").ProductCode

Reminders
~Returns a Reminders collection that represents all current reminders.
Code:
;example 1
For Reminder in ComObjActive("Outlook.Application").Reminders
MsgBox % Reminder.Caption
;example 2
MsgBox % ComObjActive("Outlook.Application").Reminders.Count

Session
~Returns the NameSpaceobject for the current session.
~The GetNamespacemethod can be used to accomplish the same thing. Only MAPI is supported.
Code:
Session := ComObjActive("Outlook.Application").Session
;or
Session := ComObjActive("Outlook.Application").GetNamespace("MAPI")

TimeZones
~Returns a TimeZonescollection that represents the set of time zones supported by Outlook.
Code:
TimeZones := ComObjActive("Outlook.Application").TimeZones
Loop % TimeZones.Count {
TimeZone := TimeZones.Item(A_Index)
Message .= TimeZone.Name . "`n"
} MsgBox % Message

Version
~Returns or sets a String indicating the number of the version.
Code:
MsgBox % ComObjActive("Outlook.Application").Version

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 15th, 2011, 1:31 pm, edited 11 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 2:20 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== Stores ===
========================================================
Stores Object
~A set of Store objects representing all the stores available in the current profile.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores

--------------------------------------------------------
=== Stores Methods ===
--------------------------------------------------------
Item
~Returns a Store object that is specified by Index.
Stores.Item(Index)
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
MsgBox % Store := Stores.Item(1).DisplayName

--------------------------------------------------------
=== Stores Properties===
--------------------------------------------------------
Application
~Returns an Application object that represents the parent Outlook application for the object.
Code:
Application := ComObjActive("Outlook.Application").Session.Application

Class
~Returns an OlObjectClass constant indicating the object's class.
Code:
MsgBox % ComObjActive("Outlook.Application").Session.Stores.Class

Count
~Returns a Long indicating the count of objects in the specified collection.
Code:
MsgBox % ComObjActive("Outlook.Application").Session.Stores.Count

Parent
~Returns the parent Object of the specified object which is the NameSpace object.
Code:
Parent := ComObjActive("Outlook.Application").Session.Stores.Parent

Session
~Returns the NameSpace object for the current session.
Code:
Session := ComObjActive("Outlook.Application").Session
;or
NameSpace := ComObjActive("Outlook.Application").GetNamespace("MAPI") ;MAPI is the only accepted constant

--------------------------------------------------------
=== Stores Events ===
--------------------------------------------------------
BeforeStoreRemove
~Occurs when a Store is about to be removed from the current session either programmatically or through user action.
Stores.BeforeStoreRemove(Store, Cancel)
- Store(Required): The Store object to be removed from the current session.
- Cancel(Required): True to cancel the removal of the specified store, False otherwise.
~Stores can be removed by calling Session.RemoveStore
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1).DisplayName
Stores.BeforeStoreRemove(Store, False)

StoreAdd
~Occurs when a Store has been added to the current session either programmatically or through user action.
Stores.StoreAdd(Store)
- Store(Required): The Store to be added to the current session.
~A Store can be added by using the Session.AddStore method.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1).DisplayName
Stores.StoreAdd(Store)

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 14th, 2011, 6:37 pm, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 2:21 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== Store Object ===
========================================================
~Represents a file on the local computer or a network drive that stores e-mail messages and other items for an account in the current profile.

--------------------------------------------------------
=== Store Methods ===
--------------------------------------------------------
GetRootFolder
~Returns a Folder object representing the root-level folder of the Store.
~The Parent propery returns "MAPI".
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Root := Store.GetRootFolder
Folders := Root.Folders
Loop % Folders.Count
   Message .= Folders.Item(A_Index).Name . "`n"
MsgBox % Message

GetRules
~Returns a Rules collection object that contains the Rule objects defined for the current session.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).Name . "`n"
MsgBox % Message

GetSearchFolders
~Returns a Folders collection object that represents the search folders defined for the Store object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Folders := Store.GetSearchFolders
Loop % Folders.Count
   Message .= Folders.Item(A_Index).Name . "`n"
MsgBox % Message

GetSpecialFolder
~Returns a Folder object for a special folder specified by FolderType in a given store.
Store.GetSpecialFolder(FolderType)
- FolderType(Required): A constant in the OlSpecialFolders enumeration that specifies the type of the special folder in the store.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Folder0 := Store.GetSpecialFolder(0)
Folder1 := Store.GetSpecialFolder(1)
If (Folder0 = "") or (Folder1 = "")
   MsgBox, Nata
Else MsgBox % Folder0.Name . ", " . Folder1.Name

--------------------------------------------------------
=== Store Properties ===
--------------------------------------------------------
Application
~Returns an Application object that represents the parent Outlook application for the object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1).Application

Class
~Returns an OlObjectClass constant indicating the object's class.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).Class . "`n"
MsgBox % Message

DisplayName
~Returns a String representing the display name of the Store object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).DisplayName . "`n"
MsgBox % Message

ExchangeStoreType
~Returns a constant in the OlExchangeStoreType enumeration that indicates the type of an Exchange store.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).ExchangeStoreType . "`n"
MsgBox % Message

FilePath
~Returns a String representing the full file path for a Personal Folders File (.pst) or an Offline Folder File (.ost) store.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).FilePath . "`n"
MsgBox % Message

IsCachedExchange
~Returns true or false which indicates if the Store is a cached Exchange store.
~Returns true if it is a olExchangePrimaryMailbox otherwise it returns false.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).IsCachedExchange . "`n"
MsgBox % Message

IsDataFileStore
~Returns true or false which indicates if the Store is a store for an Outlook data file, which is either a Personal Folders File (.pst) or an Offline Folder File (.ost).
~IsDataFileStore supports only Exchange stores, and will return False for HTTP-type stores such as Hotmail and MSN, and for IMAP stores.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).IsDataFileStore . "`n"
MsgBox % Message

IsInstantSearchEnabled
~Returns true or false which indicates whether Instant Search is enabled and operational on a store.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).IsInstantSearchEnabled . "`n"
MsgBox % Message

IsOpen
~Returns true or false which indicates if the Store is open.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).IsOpen . "`n"
MsgBox % Message

Parent
~Returns the parent object of the specified object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Parent := Stores.Item(1).Parent

PropertyAccessor
~Returns a PropertyAccessor object that supports creating, getting, setting, and deleting properties of the parent Store object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
PropertyAccessor := Stores.Item(1).PropertyAccessor

Session
~Returns the NameSpace object for the current session.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Session := Stores.Item(1).Session

StoreID
~Returns a String identifying the Store.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Loop % Stores.Count
   Message .= Stores.Item(A_Index).StoreID . "`n"
MsgBox % Message

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 14th, 2011, 6:37 pm, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 2:21 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== Rules Object ===
========================================================
~Represents a set of Rule objects that are the rules available in the current session.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules

--------------------------------------------------------
=== Rules Methods ===
--------------------------------------------------------
Create
~Creates a Rule object with the name specified by Name and the type of rule specified by RuleType.
Rules.Create(Name, RuleType)
- Name(Required): A string identifier for the rule, which will be represented by Rule.Name after rule creation. Names of rules in a collection are not unique.
- RuleType(Required): A constant in the OlRuleType enumeration that determines whether the rule is applied on sending or receiving a message.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores ;see stores
Store := Stores.Item(1) ;see store
Rules := Store.GetRules
olRuleReceive := 0
olRuleSend := 1
Name := "TestRule"
Rules.Create(Name, olRuleReceive)

Item
~Obtains a Rule object specified by Index, which is either a numerical index into the Rules collection or the rule name.
Rules.Item(Index)
- Index(Required): Either a 1-based long value representing an index into the Rules collection, or a string name representing the value of the default property of a rule, Rule.Name.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores ;see stores
Store := Stores.Item(1) ;see store
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).Name . "`n"
MsgBox % Message
;or
Loop % Rules.Count
   If (Rules.Item(A_Index).Name = "TestRule")
      MsgBox, Found

Remove
~Removes from the Rules collection a Rule object specified by Index, which is either a numerical index into the Rules collection or the rule name.
Rules.Remove(Index)
- Index(Required): Either a long value representing an index into the Rules collection, or a string name representing the value of the default property of a rule, Rule.Name.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores ;see stores
Store := Stores.Item(1) ;see store
Rules := Store.GetRules
Loop % Rules.Count
   If (Name := Rules.Item(A_Index).Name = "TestRule") {
      Rules.Remove(Name)
      MsgBox, Found
      Break
   }

Save
~Saves all rules in the Rules collection.
Rules.Save(ShowProgress)
- ShowProgress(Optional): True to display the progress dialog box, False to save rules without showing the progress.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores ;see stores
Store := Stores.Item(1) ;see store
Rules := Store.GetRules
Rules.Save(False)
Code:
 ;example using all 4 methods
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules

olRuleReceive := 0
Name := "TestRule"
Rules.Create(Name, olRuleReceive)
Rules.Save(False)

Loop % Rules.Count
   If (Name := Rules.Item(A_Index).Name = "TestRule") {
      Rules.Remove(Name)
      Rules.Save(False)
      MsgBox, Found
      Break
   }

--------------------------------------------------------
=== Rules Properties ===
--------------------------------------------------------
Application
~Returns an Application object that represents the parent Outlook application for the object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
Application := Rules.Application

Class
~Returns an OlObjectClass constant indicating the object's class.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
MsgBox % Class := Rules.Class

Count
~Returns a Long indicating the count of objects in the specified collection.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
MsgBox % Count := Rules.Count

IsRssRulesProcessingEnabled
~Returns or sets true or false which indicates whether RSS rules processing has been enabled.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
MsgBox % Boolean := Rules.IsRssRulesProcessingEnabled

Parent
~Returns the parent Object of the specified object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
Parent := Rules.Parent

Session
~Returns the NameSpace object for the current session.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1) ;see stores
Rules := Store.GetRules
Session := Rules.Session

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 14th, 2011, 6:37 pm, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 9:18 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== Rule Object ===
========================================================
~Represents an Outlook rule.

--------------------------------------------------------
=== Rule Methods ===
--------------------------------------------------------
Excecute
~Applies a rule as an one-off operation.
Rule.Execute(ShowProgress, Folder, IncludeSubfolders, RuleExecuteOption)
- ShowProgress(Optional): True to display the progress dialog box when the rule is executed, False to run the rule without displaying the dialog box.
- Folder(Optional): Represents the folder where the rule will be applied.
- IncludeSubfolders(Optional): True to apply the rule to subfolders of the folder indicated by the Folder parameter; False to apply the rule only to that folder but not its subfolders.
- RuleExecuteOption(Optional): A OlRuleExecuteOption which represents whether to apply the rule to read, unread, or all messages in the folder or folders specified by the Folder and IncludeSubfolders parameters.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Rule := Rules.Item(1)
ShowProgress := 0 ;default
;Folder := "Inbox" ;default "Error"
;IncludeSubfolders := 0 ;default "Error"
;RuleExecuteOption := 0 ;default "Error"
Rule.Execute(ShowProgress) ;, Folder, IncludeSubfolders, RuleExecuteOption) "Error"

--------------------------------------------------------
=== Rule Properties ===
--------------------------------------------------------
Actions
~Returns a RuleActions collection object that represents all the available rule actions for the rule.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.Count

Application
~See Application

Class
~Returns an OlObjectClass constant indicating the object's class.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).Class . "`n"
MsgBox % Message

Conditions
Returns a RuleConditions collection object that represents all the available rule conditions for the rule.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleConditions := Rules.Item(1).Conditions
Loop % Rules.Count
   Message .= Class := RuleConditions.Item(A_Index).Class . "`n"
MsgBox % Message

Enabled
~Returns true or false which determines if the rule is to be applied.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
MsgBox % Rules.Item(1).Enabled

Exceptions
~Returns a RuleConditions collection object that represents all the available rule exception conditions for the rule.
~The Exceptions and Conditions properties share the same pool of conditions.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleExceptions := Rules.Item(1).Exceptions
Loop % Rules.Count
   Message .= Class := RuleExceptions.Item(A_Index).Class . "`n"
MsgBox % Message

ExecutionORder
~Returns or sets a Long that indicates the order of execution of the rule among other rules in the Rules collection.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).ExecutionOrder . "`n"
MsgBox % Message

IsLocalRule
~Returns true or false which indicates if the rule executes as a client-side rule.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).IsLocalRule . "`n"
MsgBox % Message

Name
~Returns or sets a String representing the name of the rule.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).Name . "`n"
MsgBox % Message

Parent
~Returns the parent Object of the specified object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Parent := Rules.Item(1).Parent

RuleType
~Returns a constant from the OlRuleType enumeration that indicates if the rule applies to messages that are being sent or received.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Loop % Rules.Count
   Message .= Rules.Item(A_Index).RuleType . "`n"
MsgBox % Message
;applied to messages that are being received: olRuleReceive(0)
;applied to messages that are being sent: olRuleSend(1)

Session
~See Session.

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 14th, 2011, 6:36 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 12:11 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
========================================================
=== RuleActions Object ===
========================================================
~The RuleActions object contains a set of RuleAction objects or objects derived from RuleAction, representing the actions that are executed on a Rule object.

--------------------------------------------------------
=== RuleActions Methods ===
--------------------------------------------------------
Item
~Obtains a RuleAction object specified by Index which is a numerical index into the RuleActions collection.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
Loop % RuleActions.Count
   Message .= RuleActions.Item(A_Index).ActionType . "`n"
MsgBox % Message

--------------------------------------------------------
=== RuleActions Properties ===
--------------------------------------------------------
Application
~See Application

AssignToCategory
~Returns an AssignToCategoryRuleAction object with AssignToCategoryRuleAction.ActionType being olRuleAssignToCategory.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.AssignToCategory.Class

CC
~Returns a SendRuleAction object with SendRuleAction.ActionType being olRuleActionCcMessage.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.CC.Class

Class
~Returns an OlObjectClass constant indicating the object's class.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.Class

ClearCategories
~Returns a RuleAction object with a RuleAction.ActionType of olRuleActionClearCategories.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
ClearCategories := RuleActions.ClearCategories

CopyToFolder
~Returns a MoveOrCopyRuleAction object with MoveOrCopyRuleAction.ActionType being olRuleActionCopyToFolder.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.CopyToFolder.Class

Count
~Returns a Long indicating the count of objects in the specified collection.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions
MsgBox % RuleActions.Count

Delete
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionDelete.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Rules.Item(1).Actions.Delete

DeletePermanently
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionDeletePermanently.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Rules.Item(1).Actions.DeletePermanently

DesktopAlert
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionDesktopAlert.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.DesktopAlert

Forward
~Returns a SendRuleAction object with SendRuleAction.ActionType being olRuleActionForward.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.Forward

ForwardAsAttachment
~Returns a SendRuleAction object with SendRuleAction.ActionType being olRuleActionForwardAsAttachment.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.ForwardAsAttachment

MarkAsTask
~Returns a MarkAsTaskRuleAction object with MarkAsTaskRuleAction.ActionType being olRuleActionMarkAsTask.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.MarkAsTask

MoveToFolder
~Returns a MoveOrCopyRuleAction object with MoveOrCopyRuleAction.ActionType being olRuleActionMoveToFolder.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.MoveToFolder

NewItemAlert
~Returns a NewItemAlertRuleAction object with ActionType being olRuleActionNewItemAlert.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.NewItemAlert

NotifyDelivery
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionNotifyDelivery.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.NewItemAlert

NotifyRead
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionNotifyRead.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.NotifyRead

Parent
~Returns the parent Object of the specified object.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
Parent := Rules.Item(1).Actions.Parent

PlaySound
~Returns a PlaySoundRuleAction object with PlaySoundRuleAction.ActionType being olRuleActionNotifyRead.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.PlaySound

Redirect
~Returns a SendRuleAction object with SendRuleAction.ActionType being olRuleActionRedirect.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.Redirect

Session
~See Session

Stop
~Returns a RuleAction object with RuleAction.ActionType being olRuleActionStop.
Code:
Stores := ComObjActive("Outlook.Application").Session.Stores
Store := Stores.Item(1)
Rules := Store.GetRules
RuleActions := Rules.Item(1).Actions.Stop

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Last edited by Mickers on September 14th, 2011, 6:36 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 1:41 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Much more coherent tutorial than your first great job

Suggestion?
explain or give an example of what things like activeExplorer are activeInspector etc. your tuts are touted as noob friendly its easy to forget that as we learn these things such terms become common place to us but is what confused us in the beginning.


Again great documentation model

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 1:59 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
@tank
Thanks! Praise from you is rare at best. :D
Quote:
Suggestion?
explain or give an example of what things like activeExplorer are activeInspector etc. your tuts are touted as noob friendly its easy to forget that as we learn these things such terms become common place to us but is what confused us in the beginning.
Yes your right about that. I'm still learning how Outlook COM works. I've put about 25 hours into this project so far and once I feel it's as complete as I can make it I'll go back and give better examples. :wink:

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 2:25 pm 
Offline

Joined: July 6th, 2011, 5:37 pm
Posts: 214
Location: Looking over my domain
I am especially happy because you linked to msdn. lest the reader forget that these are not ahk methods. AHK is just the vehicle

_________________
Image Stolen from SKAN


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2011, 10:41 am 
Offline

Joined: May 26th, 2011, 7:53 am
Posts: 237
Location: uk
Example of adding an outlook task?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2011, 3:58 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
I dont have the time towork the example found here into AHK but perhaps in seeing it it will become obvious to you hwo to do so

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Ragnar and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group