CreateObject Method

Creates an Automation object of the specified class.

Note   Use this method if you are automating Microsoft Outlook by using VB Script. Use the CreateObject function if you are automating Microsoft Outlook by using Visual Basic for Applications in another application.

Syntax

expression.CreateObject(ObjectName)

expression   An expression that returns an Application object.

ObjectName   Required String. The class name of the object to create. For information about valid class names, see OLE Programmatic Identifiers.


OLE Programmatic Identifiers (Microsoft Outlook)

You use an OLE programmatic identifier (sometimes called a ProgID) to create an Automation object.

To create an Automation object that represents the Microsoft Outlook Application object, use "Outlook.Application.8." Using "Outlook.Application" with no version number creates an Application object that represents the most recent version of Microsoft Outlook available on the machine where the macro is running.


Organizer Property

Returns the name of the organizer of the appointment. Read-only String.


IsWordMail Method

Determines whether the mail message associated with an inspector is displayed in an Outlook inspector or in Microsoft Word. Returns True if the mail message is displayed in Microsoft Word (that is, if Word Mail is in use).

Syntax

expression.IsWordMail

expression   An expression that returns an Inspector object.


Microsoft Outlook Objects


Microsoft Outlook Constants

When you automate Microsoft Outlook by using an Automation object in an application that supports Visual Basic for Applications, you can use built-in constants to specify property and argument values.

However, when you automate Microsoft Outlook by using VB Script, you must use the numeric values that the constants represent. The following tables list the built-in Microsoft Outlook constants and their numeric values.

OlActionCopyLike

Constant	Value
olReply	0
olReplyAll	1
olForward	2
olReplyFolder	3
olRespond	4
OlActionReplyStyle

Constant	Value
olOmitOriginalText	0
olEmbedOriginalItem	1
olIncludeOriginalText	2
olIndentOriginalText	3
OlActionResponseStyle

Constant	Value
olOpen	0
olSend	1
olPrompt	2
OlActionShowOn

Constant	Value
olDontShow	0
olMenu	1
olMenuAndToolbar	2
OlAttachmentType

Constant	Value
olByValue	1
olByReference	4
olEmbeddedItem	5
olOLE	6
OlBusyStatus

Constant	Value
olFree	0
olTentative	1
olBusy	2
olOutOfOffice	3
OlDaysOfWeek

Constant	Value
olSunday	1
olMonday	2
olTuesday	4
olWednesday	8
olThursday	16
olFriday	32
olSaturday	64
OlDefaultFolders

Constant	Value
olFolderDeletedItems	3
olFolderOutbox	4
olFolderSentMail	5
olFolderInbox	6
olFolderCalendar	9
olFolderContacts	10
olFolderJournal	11
olFolderNotes	12
olFolderTasks	13
OlFlagStatus

Constant	Value
olNoFlag	0
olFlagComplete	1
olFlagMarked	2
OlFolderDisplayMode

Constant	Value
olFolderDisplayNormal	0
olFolderDisplayFolderOnly	1
olFolderDisplayNoNavigation	2
OlFormRegistry

Constant	Value
olDefaultRegistry	0
olPersonalRegistry	2
olFolderRegistry	3
olOrganizationRegistry	4
OlGender

Constant	Value
olUnspecified	0
olFemale	1
olMale	2
OlImportance

Constant	Value
olImportanceLow	0
olImportanceNormal	1
olImportanceHigh	2
OlInspectorClose

Constant	Value
olSave	0
olDiscard	1
olPromptForSave	2
OlItems

Constant	Value
olMailItem	0
olAppointmentItem	1
olContactItem	2
olTaskItem	3
olJournalItem	4
olNoteItem	5
olPostItem	6
OlJournalRecipientType

Constant	Value
olAssociatedContact	1
OlMailingAddress

Constant	Value
olNone	0
olHome	1
olBusiness	2
olOther	3
OlMailRecipientType

Constant	Value
olOriginator	0
olTo	1
olCC	2
olBCC	3
OlMeetingRecipientType

Constant	Value
olOrganizer	0
olRequired	1
olOptional	2
olResource	3
OlMeetingResponse

Constant	Value
olMeetingTentative	2
olMeetingAccepted	3
olMeetingDeclined	4
OlMeetingStatus

Constant	Value
olNonMeeting	0
olMeeting	1
olMeetingReceived	3
olMeetingCanceled	5
OlNoteColor

Constant	Value
olBlue	0
olGreen	1
olPink	2
olYellow	3
olWhite	4
OlRecurrenceType

Constant	Value
olRecursDaily	0
olRecursWeekly	1
olRecursMonthly	2
olRecursMonthNth	3
olRecursYearly	5
olRecursYearNth	6
OlRemoteStatus

Constant	Value
olRemoteStatusNone	0
olUnMarked	1
olMarkedForDownload	2
olMarkedForCopy	3
olMarkedForDelete	4
OlResponseStatus

Constant	Value
olResponseNone	0
olResponseOrganized	1
olResponseTentative	2
olResponseAccepted	3
olResponseDeclined	4
olResponseNotResponded	5
OlSaveAsType

Constant	Value
olTXT	0
olRTF	1
olTemplate	2
olMSG	3
olDoc	4
OlSensitivity

Constant	Value
olNormal	0
olPersonal	1
olPrivate	2
olConfidential	3
OlTaskDelegationState

Constant	Value
olTaskNotDelegated	0
olTaskDelegationUnknown	1
olTaskDelegationAccepted	2
olTaskDelegationDeclined	3
OlTaskOwnership

Constant	Value
olNewTask	0
olDelegatedTask	1
olOwnTask	2
OlTaskRecipientType

Constant	Value
olUpdate	1
olFinalStatus	2
OlTaskResponse

Constant	Value
olTaskSimple	0
olTaskAssign	1
olTaskAccept	2
olTaskDecline	3
OlTaskStatus

Constant	Value
olTaskNotStarted	0
olTaskInProgress	1
olTaskComplete	2
olTaskWaiting	3
olTaskDeferred	4
OlTrackingStatus

Constant	Value
olTrackingNone	0
olTrackingDelivered	1
olTrackingNotDelivered	2
olTrackingNotRead	3
olTrackingRecallFailure	4
olTrackingRecallSuccess	5
olTrackingRead	6
olTrackingReplied	7
OlUserPropertyType

Constant	Value
olText	1
olNumber	3
olDateTime	5
olYesNo	6
olDuration	7
olKeywords	11
olPercent	12
olCurrency	14
olFormula	18
olCombination	19


Help Topic Not Available

The Help topic cannot be displayed because Visual Basic for Applications Help cannot be found or was not installed.

To install Visual Basic for Applications Help

1.	Run Microsoft Office 97 Setup, and click Add/Remove.

2.	Click Microsoft Outlook, and then click Change Option.

3.	Make sure that the Microsoft Outlook Program Files check box is selected.

4.	Continue with Setup.


Help topic not available

The Help topic cannot be displayed because Microsoft Office Visual Basic Help cannot be found or was not installed.

To install Visual Basic for Applications Help

1.	Run Microsoft Office 97 Setup, and click Add/Remove.

2.	Click Microsoft Outlook, and then click Change Option.

3.	Make sure that the Microsoft Outlook Program Files check box is selected.

4.	Continue with Setup.


Add Method

Adds an object to a collection. Select one of the following collections to see a detailed description of the Add method for that collection.

Actions

Attachments

Folders

Items

Pages

Recipients

UserProperties


Add Method (Attachments Collection)

Creates a new attachment in the Attachments collection, and returns the new attachment as an Attachment object.

Syntax

expression.Add(Source, Type, Position, DisplayName)

expression   An expression that returns an Attachments object.

Source   Required String. The file (represented by the full path and file name) or item that constitutes the attachment.

Type   Optional Long. The type of attachment. Can be one of the following OlAttachmentType constants: olByReference, olByValue, olEmbeddedItem, or olOLE.

Position   Optional Long. The position of the attachment within the body text of the message.

DisplayName   Optional String. The display name of the attachment.


Add Method (Attachments Object) Example

This example creates a new mail message, attaches a Microsoft Excel workbook as an attachment (not a link) and gives the attachment a descriptive caption.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAttachments = myItem.Attachments

myAttachments.Add "C:\My Documents\Q496.xls", _

    olByValue, 1, "4th Quarter 1996 Results Chart"

This example creates a new mail message and attaches a Microsoft Word document from a server using a link.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAttachments = myItem.Attachments

myAttachments.Add "\\MYSVR1\Reports\Q496Report.doc", _

    olByReference

This example creates a new mail message and attaches the first contact in the default Contacts folder.

Set myFolder = _

    olNameSpace.GetDefaultFolder(olFolderContacts)

Set myFirstContact = myFolder.Items(1)

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAttachments = myItem.Attachments

myAttachments.Add myFirstContact


Add Method (Items Object)

Creates a new Outlook item in the Items collection for the folder, and returns the new item. If not specified, the type of the item defaults to the type of the folder, or to MailItem if the parent folder is not typed.

Syntax

expression.Add(Type)

expression   An expression that returns an Items object.

Type   Optional Variant. The Outlook item type for the new item. Can be one of the following OlItems constants: olAppointmentItem, olContactItem, olJournalItem, olMailItem, olNoteItem, olPostItem, or olTaskItem or any valid message class. Specify the message class to create customs forms.


Add Method (Items Object) Example

This example gets the current Contacts folder and adds a new ContactItem object to it.

Set myFolder = _

    olNamespace.GetDefaultFolder(olFolderContacts)

Set myItem = myFolder.Items.Add

This example adds a custom form to the default Tasks folder.

Set myFolder = _

    olNamespace.GetDefaultFolder(olFolderTasks)

Set myItems = myFolder.Items

Set myItem = myItems.Add("IPM.Task.myTask")


Add Method (Pages Collection)

Creates a new page in the Pages collection, and returns the new page. The Pages collection is initially empty and there is a limit of 5 customizable pages per collection.

Syntax

expression.Add(Name)

expression   An expression that returns a Pages object.

Name   Required String. The name of the page.


Add Method (Pages Collection) Example

This example returns a new custom page named "My Page" (the same call without a name will return the next available page for customization — for example, "Custom1").

Set myPages = myItem.GetInspector.ModifiedFormPages

Set myPage = myPages.Add("My Page")

This example returns the Message page of a MailItem.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myPages = myItem.GetInspector.ModifiedFormPages

Set myPage = myPages.Add("Message")

This example returns the General (main) page of a ContactItem.

Set myItem = myOlApp.CreateItem(olContactItem)

Set myPages = myItem.GetInspector.ModifiedFormPages

Set myPage = myPages.Add("General")


Add Method (UserProperties Collection)

Creates a new user property in the UserProperties collection, and returns the new property as a UserProperty object.

Syntax

expression.Add(Name, Type, AddToFolderFields, DisplayFormat)

expression   An expression that returns a UserProperties object.

Name   Required String. The name of the property.

Type   Required Long. The type of the property. Can be one of the following OlUserPropertyType constants: olCombination, olCurrency, olDateTime, olDuration, olFormula, olKeywords, olNumber, olPercent, olText, or olYesNo.

AddToFolderFields   Optional Boolean. True if the property will be added to the folder fields, False if not. The default value is True.

DisplayFormat   Optional Long. The index of the format of the specified OlUserPropertyType constant. For more information, see the "Remarks" section.

Remarks

To look up the index of a format to specify for the DisplayFormat argument, follow these steps.

1	Open a new item.

2	On the Tools menu, click Design Outlook Form.

3	Click an empty page, and then click the Field Chooser button on the Supernote toolbar.

4	In the Field Chooser, click the New button.

5	In the New Field dialog box, select the appropriate field type in the Type box, and then find the format you want in the Format box. The index of the format corresponds to its position in this list.


Add Method (UserProperties Collection) Example

This example creates a new ContactItem object and adds "LastDateSpokenWith" as a user property.

Set myItem = myOlApp.CreateItem(olContactItem)

Set myUserProperty = myItem.UserProperties _

    .Add("LastDateSpokenWith", olDateTime)


DisplayName Property

Returns or sets the name, which need not be the actual file name, displayed below the icon representing the embedded attachment. This property corresponds to the MAPI property PR_DISPLAY_NAME. Read/write String.


Find Method

Items object: Applies the filter to the Items collection and returns the first Item object matching the filter.

UserProperties object: Locates and returns a UserProperty object for the requested property name, if it exists.

Syntax 1

expression.Find(Filter)

Syntax 2

expression.Find(Name, Custom)

expression   An expression that returns an Items object (Syntax 1) or a UserProperties object (Syntax 2).

Filter   Required String. An expression that will evaluate to True or False.

The filter is a string expression containing one or more filter clauses joined by the logical operators And, Not and Or.

A filter clause is a simple expression that evaluates to True or False; for example, [CompanyName] = "Microsoft".

Note that property names can be used in the expression and are identified and delimited by square brackets. Except for these bracketed property names, only literals are allowed within the expression — variables and constants are not evaluated.

Comparison operators allowed within the filter expression include >, <, >=, <=, = and <>.

Logical operators allowed are And, Not and Or.

Name   Required String. The display name of the requested property.

Custom   Optional Boolean. True if the requested property is a user (custom) property. False if it is a system property. The default value is True.

Remarks

For the UserProperties object, Find cannot be used, and will cause an error, with the following properties:

ConversationIndex Email1EntryID Email2EntryID Email3EntryID EntryID ReceivedByEntryID	ReceivedOnBehalfOfEntryID ResponseState Saved Unread UserCertificate VotingOptions


Find Method Example

This example opens the default Calendar folder and finds the first appointment whose subject is "Golf w/ Jerry Wheeler."

Set myCalendar = olNameSpace.GetDefaultFolder (olFolderCalendar)

Set myItem = myCalendar.Items.Find("[Subject] = _

    ""Golf w/ Jerry Wheeler""")

This example opens the default Contacts folder and finds the first contact filed as "Jones" whose first name is "Brent."

Set myContacts = olNameSpace.GetDefaultFolder (olFolderContacts)

Set myItem = myContacts.Items.Find("[FileAs] = _

    ""Jones"" and [FirstName] = ""Brent""")

This example finds a custom property named "LastDateContacted" for the contact.

Set myProperty = _

    myContact.UserProperties.Find("LastDateContacted")

MsgBox "Last Date Contacted: " & myProperty.Value


FreeBusy Method

Returns free/busy information for the recipient. The default is to return a string representing one month of free/busy information compatible with the Microsoft Schedule+ Automation format (that is, the string contains one character for each MinPerChar minute, up to one month of information from the specified Start date).

If the optional argument CompleteFormat is omitted or False, then "free" is indicated by the character 0 and all other states by the character 1.

If CompleteFormat is True, then the same length string is returned as defined above, but the characters now correspond to the OlBusyStatus constants: olBusy (2), olFree (0), olOutOfOffice (3) or olTentative (1).

Syntax

expression.FreeBusy(Start, MinPerChar, CompleteFormat)

expression   An expression that returns a Recipient object.

Start   Required Date. The start date for the returned period of free/busy information.

MinPerChar   Required Long. The number of minutes per character represented in the returned free/busy string.

CompleteFormat   Optional Boolean. True if the returned string should contain not only free/busy information, but also values for each character according to the OlBusyStatus constants: olBusy (2), olFree (0), olOutOfOffice (3) and olTentative (1).


FreeBusy Property Example

This example returns a string of free/busy information with one character for each day.

Set myRecipient = olNameSpace.CreateRecipient("Paul _

    Borm")

myFBInfo = myRecipient.FreeBusy(#8/1/97#, 60 * 24)

This example returns a string of free/busy information with one character for each hour (complete format).

Set myRecipient = olNameSpace.CreateRecipient("Kevin _

    Yim")

myFBInfo = myRecipient.FreeBusy(#8/1/97#, 60, True)


GetExplorer Method

Returns an Explorer object that represents a new, inactive explorer initialized with the specified folder as the current folder. This method is useful for returning a new Explorer object in which to display the folder, as opposed to using the ActiveExplorer method and setting the CurrentFolder property.

By default, the new explorer will be displayed in the Normal mode with all interface elements displayed: a message panel on the right, an Outlook bar on the left, and a folder banner across the top from which the user can pull down a folder navigation panel. The explorer can also be displayed in Folder Only mode with only the message panel and folder banner and No Navigation mode with only the message panel.

Syntax

expression.GetExplorer(DisplayMode)

expression   An expression that returns a MAPIFolder object.

DisplayMode   Optional Long. The display mode of the folder. Can be one of the following OlFolderDisplayMode constants: olFolderDisplayFolderOnly, olFolderDisplayNoNavigation or olFolderDisplayNormal. The default value is olFolderDisplayNormal.


GetExplorer Method Example

This example returns a new, inactive explorer for myFolder, and then displays it.

Set myExplorer = myFolder.GetExplorer

myExplorer.Display


GetInspector Property

Returns an Inspector object that represents a new, inactive inspector initialized to contain the specified item. This property is useful for returning a new Inspector object in which to display the item, as opposed to using the ActiveInspector method and setting the CurrentItem property. Read-only.


GetInspector Property Example

This example returns a new, inactive inspector for myItem, and then displays it.

Set myInspector = myItem.GetInspector

myInspector.Display


GetSharedDefaultFolder Method

Returns a MAPIFolder object that represents the specified default folder for the specified user. This method is most useful in the delegation scenario, where one user has delegated access to another for one or more of their default folders (for example, their shared Calendar folder).

Syntax

expression.GetSharedDefaultFolder(RecipientObject, FolderTypeEnum)

expression   An expression that returns a NameSpace object.

RecipientObject   Required Recipient object. The owner of the folder. The Recipient object must be resolved.

FolderTypeEnum   Required Long. The type of folder. Can be one of the following OlDefaultFolders constants: olFolderCalendar, olFolderContacts, olFolderDeletedItems, olFolderInbox, olFolderJournal, olFolderNotes, olFolderOutbox, olFolderSentMail, or olFolderTasks.


GetSharedDefaultFolder Method Example

This example resolves the Recipient object representing Kim Buhler, and then returns her shared default Contacts folder.

Set myRecipient = olNameSpace.CreateRecipient("Kim _

    Buhler")

myRecipient.Resolve

If myRecipient.Resolved Then

    Set KimContactsFolder = _

        olNameSpace.GetSharedDefaultFolder _

        (myRecipient, olFolderContacts)

End If


Hidden Property

True if the associated tabbed dialog box of the FormDescription property sheet is visible to the user. Other views of the same dialog box are not affected. The default value is False. Read/write Boolean.


IncludeRecurrences Property

True if the Items collection should include recurrence patterns. This property only has an effect if the Items collection contains appointments and is not sorted by any property other than Start in ascending order. The default value is False. Read/write Boolean.

Remarks

Use this property when you want to retrieve all appointments for a given date, where recurring appointments would not normally appear because they are not associated with any specific date. If the collection includes recurring appointments with no end date, setting the property to True may cause the collection to be of infinite count. Be sure to include a test for this in any loop.


Instance Property

Returns or sets the count for which the recurrence pattern is valid for a given interval. This property is only valid for recurrences of the olRecursMonthNth and olRecursYearNth type and allows the definition of a recurrence pattern that is only valid for the Nth occurrence, such as "the 2nd Sunday in March" pattern. The count is set numerically: 1 for the first, 2 for the second, and so on through 5 for the last. Values greater than 5 will generate errors when the pattern is saved. Read/write Long.


Item Method

Returns the specified Action, Attachment, MAPIFolder, Outlook item, page, Recipient, or UserProperty object from its respective Actions, Attachments, Folders, Items, Pages, Recipients or UserProperties collection.

Syntax

expression.Item(Index)

expression   An expression that returns an Actions, Attachments, Folders, Items, Pages, Recipients or UserProperties object.

Index   Required Variant. Either the index number of the object, or a value used to match the default property of an object in the collection.


Item Method Example

This example returns the second MailItem object in the default Inbox folder. It assumes that at least two MailItem objects already exist.

Set myFolder = _

    olNameSpace.GetDefaultFolder(olFolderInbox)

Set mySecondItem = myFolder.Items.Item(2)

This example returns the "Forward" action from the Actions collection.

Set myItem = myOlApp.ActiveInspector.CurrentItem

Set myAction = myItem.Actions.Item("Forward")

This example returns a MAPIFolder object from a Folders collection.

Set myFolders = olNameSpace.Folders

Set myFolder = myFolders.Item("Public Folder")

This example also returns a MAPIFolder object from a Folders collection.

Set myFolders = _

    myOlApp.ActiveExplorer.CurrentFolder.Folders

Set myFolder = myFolders.Item("Project X")

This example creates a contact, returns its empty Pages collection, adds three custom pages and then returns the first custom page from the collection.

Set myItem = myOlApp.CreateItem(olContactItem)

Set myPages = myItem.GetInspector.ModifiedFormPages

myPages.Add "One"

myPages.Add "Two"

myPages.Add "Three"

Set myPage = myPages.Item("One")

This example creates a mail message, adds four Recipient objects, then returns the third recipient from the newly-created Recipients collection and sets it as a BCC recipient.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipients = myItem.Recipients

myRecipients.Add("Rich Andrews")

myRecipients.Add("Robin Hjellin")

myRecipients.Add("Meng Phua")

myRecipients.Add("Kim Yoshida")

myRecipients.Item(3) = olBCC

This example returns the "Total Cost" user property from the "My Order Form" UserProperties collection.

Set myItems = myOlApp.ActiveExplorer.CurrentItem.Items

Set myItem = myItems.Add("My Order Form")

Set myProperties = myItem.UserProperties

Set myProperty = myProperties.Item("Total Cost")


Regenerate Property

True if the task should be regenerated following this pass through the recurrence pattern. This property is used to control the regeneration of the task as each occurrence of a recurring task is completed. Read/write Boolean.


Regenerate Property Example

This example creates a task called "Oil Change" that recurs every three months and sets it to regenerate after each recurrence.

Set myItem = myOlApp.CreateItem(olTaskItem)

Set myPattern = myItem.GetRecurrencePattern

myPattern.RecurrenceType = olRecursMonthly

myPattern.Regenerate = True

myPattern.Interval = 3

myItem.Subject = "Oil Change"

myItem.Save

myItem.Display


Respond Method

Responds to a meeting request for the AppointmentItem object or a task request for the TaskItem object.

Syntax

expression.Respond(IResponse, fNoUI, fAdditionalTextDialog)

expression   An expression that returns a AppointmentItem or TaskItem object.

IResponse   Required Long. The response to the request. Can be one of the following OlResponseStatus constants: olResponseAccepted, olResponseDeclined, olResponseNone, olResponseNotResponded, olResponseOrganized, or olResponseTentative.

fNoUI   Optional Boolean. True to not display a dialog box; the response is sent automatically. False to display the dialog box for responding.

fAdditionalTextDialog   Optional Boolean. True to not prompt the user for input; the response is displayed in the inspector for editing. False to prompt the user to either send or send with comments. This argument is valid only if fNoUI is False.


Respond Method Example

This example gets the appointment from the meeting request, accepts the meeting request and brings up the inspector containing the response to allow entry of additional text before sending it.

set myAppt = myMtgReq.GetAssociatedAppointment(True)

myAppt.Respond olResponseAccepted, False, True


Restrict Method

Applies a filter to the Items collection, returning a new collection containing all items from the original which match the filter. This method is an alternative to using the Find method or FindNext method to iterate over specific items within a collection. Find or FindNext is faster than filtering if there are a small number of items. Restrict is useful where performance is not a concern.

Syntax

expression.Restrict(Filter)

expression   An expression that returns an Items object.

Filter   Required String. A filter string expression to be applied. For details, see the Find method.

Remarks

This property cannot be used, and will cause an error, with the following properties:

ConversationIndex Email1EntryID Email2EntryID Email3EntryID EntryID ReceivedByEntryID	ReceivedOnBehalfOfEntryID ResponseState Saved Unread UserCertificate VotingOptions


Sort Method

Sorts the collection of items by the specified property. The index for the collection is reset to 1 upon completion of this method.

Syntax

expression.Sort(Property, Descending)

expression   An expression that returns an Items object.

Property   Required String. The name of the property by which to sort, enclosed in brackets (for example, "[CompanyName]"). May not be a multi-valued property, such as a category.

Descending   Optional Boolean. True to sort in descending order. The default value is False (ascending).


Sort Method Example

The following example sorts the Items collection for the default Contacts folder by the "CompanyName" property and then displays the sorted items, each in turn.

set myFolder = _

    olNameSpace.GetDefaultFolder(olFolderContact)

myFolder.Items.Sort "[CompanyName]", False

For Each myItem in myFolder.Items

    myItem.Display

Next myItem


Account Property

Returns or sets the account for the contact. Read/write String.


ActiveExplorer Method

Returns the topmost Explorer object on the desktop. If no explorer is active, returns Nothing. Use this method to return the Explorer object the user is most likely viewing. This method is also useful for determining when there is no active explorer, so a new one can be opened.

Syntax

expression.ActiveExplorer

expression   An expression that returns an Application object.


ActiveExplorer Method Example

This example demonstrates how to obtain an Explorer object for use, preferably getting the user's active explorer, but creating a new one for myFolder if there isn't already one on the desktop.

Set myExplorer = myOlApp.ActiveExplorer

If TypeName(myExplorer) = "Nothing" Then

    Set myExplorer = myFolder.GetExplorer

End If


ActiveInspector Method

Returns the topmost Inspector object on the desktop. If no inspector is active, returns Nothing. Use this method to access the Inspector object the user is most likely viewing.

Syntax

expression.ActiveInspector

expression   An expression that returns an Application object


ActiveInspector Method Example

This example demonstrates how to obtain the currently active Inspector object and display the name of the item that the inspector is displaying.

Set myInspector = myOlApp.ActiveInspector

MsgBox "The active item is " & myInspector.CurrentItem.Subject


ActualWork Property

Returns or sets the actual effort (in minutes) spent on the task. Read/write Long.


Add Method (Folders Object)

Creates a new folder in the Folders collection, and returns the new folder as a MAPIFolder object.

Syntax

expression.Add(Name, Type)

expression   An expression that returns a Folders object.

Name   Required String. The display name for the new folder.

Type   Optional Long. The Outlook folder type for the new folder. Can be one of the following OlDefaultFolders constants: olFolderCalendar, olFolderContacts, olFolderInbox, olFolderJournal, olFolderNotes, or olFolderTasks. (The constants olFolderDeletedItems, olFolderOutbox, and olFolderSentMail cannot be specified for this argument.)


Add Method (Folders Collection) Example

This example adds the new folder named "My Contacts" to the current (default) Contacts folder.

Set myFolder = olNamespace.GetDefaultFolder(olFolderContacts)

Set myNewFolder = myFolder.Folders.Add("My Contacts")


Add Method (Recipients Object)

Creates a new recipient in the Recipients collection, and returns the new recipient as a Recipient object.

Syntax

expression.Add(Name)

expression   An expression that returns a Recipients object.

Name   Required String. The display name of the recipient.


Add Method (Recipients Collection) Example

This example creates a new mail message and adds "Allison Klein" as a To recipient.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add("Allison Klein")

This is the same example, but the recipient is changed from the default (To) to carbon copy (CC).

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add("Allison Klein")

Set myRecipient.Type = olCC


Add Method (Actions Object)

Creates a new action in the Actions collection, and returns the new action as a Action object.

Syntax

expression.Add

expression   An expression that returns an Actions object.


Add Method (Actions Object) Example

This example creates a new mail message and adds an Action to it.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAction = myItem.Actions.Add


Address Property

Returns or sets the e-mail address of the recipient. Read/write String.


AllDayEvent Property

True if the appointment is an all day event (as opposed to a specified time). Read/write Boolean.


AlternateRecipientAllowed Property

True if the mail message can be forwarded. Read/write Boolean.


Anniversary Property

Returns or sets the anniversary date for the contact. Read/write Date.


Application Property

Returns an Application object that represents the parent application (Microsoft Outlook) for the item. Read-only.


Assistant Property

Returns an Assistant object that represents the Microsoft Office Assistant. Read-only.


AssistantName Property

Returns or sets the name of the assistant for the contact. Read/write String.


AssistantTelephoneNumber Property

Returns or sets the telephone number of the assistant for the contact. Read/write String.


Attachments Property

Returns an Attachments object that represents all the attachments for the item. Read-only.


AutoResponse Property

Returns or sets the text of an automatic response for the Recipient. Read/write String.


BCC Property

Returns the display list of blind carbon copy (BCC) names for the Recipient. This property contains the display names only. The Recipients collection should be used to modify the BCC recipients. Read-only String.


BillingInformation Property

Returns or sets the billing information associated with the Outlook item. This is a free-form text field. Read/write String.


Birthday Property

Returns or sets the birthday for the contact. Read/write Date.


Body Property

Returns or sets the clear-text body of the mail message or post. Read/write String.


Business2TelephoneNumber Property

Returns or sets the second business telephone number for the contact. Read/write String.


BusinessAddress Property

Returns or sets the whole, unparsed business address for the contact. Read/write String.


BusinessAddressCity Property

Returns or sets the city name portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessAddressCountry Property

Returns or sets the country code portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessAddressPostalCode Property

Returns or sets the postal code portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessAddressPostOfficeBox Property

Returns or sets the post office box number portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessAddressState Property

Returns or sets the state code portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessAddressStreet Property

Returns or sets the street address portion of the business address for the contact. Read/write String.

Remarks

This property is parsed from the BusinessAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to the BusinessAddress property.


BusinessFaxNumber Property

Returns or sets the business fax number for the contact. Read/write String.


BusinessHomePage Property

Returns or sets the URL of the business Web page for the contact. Read/write String.


BusinessTelephoneNumber Property

Returns or sets the first business telephone number for the contact. Read/write String.


BusyStatus Property

Returns or sets the busy status of the user for the appointment. Can be one of the following OlBusyStatus constants: olBusy, olFree, olOutOfOffice, or olTentative. Read/write Long.


CallbackTelephoneNumber Property

Returns or sets the callback telephone number for the contact. Read/write String.


CardData Property

Returns or sets the text of the card data for the task. Read/write String.


CarTelephoneNumber Property

Returns or sets the car telephone number for the contact. Read/write String.


Categories Property

Returns or sets the categories assigned to the Outlook item. Read/write String array.


Category Property

Returns or sets the category assigned to the form description. Read/write String.


CategorySub Property

Returns or sets the subcategory assigned to the form description. Read/write String.


CC Property

Returns the display list of carbon copy (CC) names for the Recipient. This property contains the display names only. The Recipients collection should be used to modify the CC recipients. Read-only String.


Children Property

Returns or sets the names of the children for the contact. Read/write String array.


ClearRecurrencePattern Method

Removes the recurrence settings and restores the single-occurrence state for an appointment or task.

Syntax

expression.ClearRecurrencePattern

expression   An expression that returns a AppointmentItem or TaskItem object.


Color Property

Returns or sets the color of the note. Can be one of the following OlNoteColor constants: olBlue, olGreen, olPink, olWhite, or olYellow. Read/write Long.


Color Property Example

This example creates a new note and sets the color to blue.

Set myItem = myOlApp.CreateItem(olNoteItem)

myItem.Color = olBlue


CommandBars Property

Returns a CommandBars object that represents all the menus and toolbars in the explorer or inspector. Read-only.


Comment Property

Returns or sets the text of a comment assigned to the form description. Read/write String.


Companies Property

Returns or sets the names of the companies associated with the Outlook item. This is a free-form text field. Read/write String array.


CompanyAndFullName Property

Returns the concatenated company name and full name for the contact. Read-only String.


CompanyMainTelephoneNumber Property

Returns or sets the company main telephone number for the contact. Read/write String.


CompanyName Property

Returns or sets the company name for the contact. Read/write String.


Complete Property

True if the task is completed. Read/write Boolean.


ComputerNetworkName Property

Returns or sets the name of the computer network for the contact. Read/write String.


ContactName Property

Returns or sets the name of the person to contact for information regarding the custom form for the form description. Read/write String.


ContactNames Property

Returns the contact names associated with the journal entry. This property contains the display names for the contacts only. Use the Recipients collection to modify the contents of this string. Read-only String.


Contacts Property

Returns the contact names associated with the task. This property contains the display names for the contacts only. Use the Recipients collection to modify the contents of this string. Read-only String array.


ConversationIndex Property

Returns the index of the conversation thread of the mail message or post. Read-only String.


ConversationTopic Property

Returns the topic of the conversation thread of the mail message or post. Read-only String.


Copy Method

Creates and returns a copy of the object. This method is supported by all Outlook items.

Syntax

expression.Copy

expression   An expression that returns an object in the Applies To list.


Copy Method Example

This example creates a mail message, copies it, then moves the copy into the default Inbox folder.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

Set myItem = myOlApp.CreateItem(olMailItem)

Set myCopiedItem = myItem.Copy

myCopiedItem.Move myFolder


CopyLike Property

Returns or sets the property inheritance style to use for the action. The inheritance style is used when the action is executed to control how properties are copied to the new item created by the action. Can be one of the following OlActionCopyLike constants: olForward, olReply, olReplyAll, olReplyFolder, or olRespond. Read/write Long.


CopyTo Method

Copies the current folder in its entirety to the destination folder. Returns a MAPIFolder object that represents the new copy.

Syntax

expression.CopyTo(DestFldr)

expression   An expression that returns a MAPIFolder object.

DestFldr   Required MAPIFolder object. The folder to add the copied folder to.


CopyTo Method Example

This example copies the current folder (in this case, the default Contacts folder) to the default Inbox folder.

Set myInboxFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

Set myCurrentFolder = olNameSpace.GetDefaultFolder(olFolderContacts)

Set myNewFolder = myCurrentFolder.CopyTo(myInboxFolder)


Count Property

Returns the count of objects in the collection. Read-only Long.


CreateItem Method

Creates a new Outlook item and returns it.

Syntax

expression.CreateItem(ItemType)

expression   An expression that returns an Application object.

ItemType   Required Long. The Outlook item type for the new item. Can be one of the following OlItems constants: olAppointmentItem, olContactItem, olJournalItem, olMailItem, olNoteItem, olPostItem, or olTaskItem.


CreateItem Method Example

This example creates a new contact in the default Contacts folder.

Set myItem = myOlApp.CreateItem(olContactItem)


CreateItemFromTemplate Method

Creates a new Outlook item from an Outlook template (.oft) and returns it.

Syntax

expression.CreateItemFromTemplate(TemplatePath, InFolder)

expression   An expression that returns an Application object.

TemplatePath   Required String. The path and file name of the Outlook template for the new item.

InFolder   Optional Variant. The folder in which the item is to be created. If this argument is omitted, the default folder for the item type will be used.


CreateRecipient Method

Creates and returns a Recipient object. This method is most commonly used to create a Recipient object for use with the GetSharedDefaultFolder method (for example, to open a delegator's folder). It can also be used to verify a given name against an address book.

Syntax

expression.CreateRecipient(RecipientName)

expression   An expression that returns a NameSpace object.

RecipientName   Required String. The display name of the recipient.


CreateRecipient Method Example

This example obtains the default Calendar folder for the user Eric Lang.

Set myRecipient = olNameSpace.CreateRecipient("Eric Lang")

Set hisCalendar = olNameSpace.GetSharedDefaultFolder _

    (myRecipient, olFolderCalendar)


CreationTime Property

Returns the creation time for the Outlook item. This property corresponds to the MAPI property PR_CREATION_TIME. Read-only Date.


CurrentFolder Property

Returns or sets a MAPIFolder object that represents the current folder displayed in the explorer. Use this property to change the folder the user is viewing. Read/write MAPIFolder.


CurrentFolder Property Example

This example changes the displayed folder to the user's Calendar folder.

Set myOlApp.ActiveExplorer.CurrentFolder = _

    olNameSpace.GetDefaultFolder(olFolderCalendar)


CurrentItem Property

Returns the current item being displayed in the inspector. Read-only.


CurrentItem Property Example

This example obtains the current item the user is viewing.

Set myItem = myOlApp.ActiveInspector.CurrentItem


CurrentUser Property

Returns the currently logged on user as a Recipient object. Read-only.


CurrentUser Property Example

This example displays a message box containing the name of the currently logged on user.

MsgBox olNameSpace.CurrentUser.Name


CustomerID Property

Returns the customer ID for the contact. Read-only String.


DateCompleted Property

Returns or sets the completion date of the task. Read/write Date.


DayOfMonth Property

Returns or sets the day of the month on which the recurring appointment or task occurs. Read/write Long.


DayOfWeekMask Property

Returns or sets the mask for the days of the week on which the recurring appointment or task occurs. Monthly and yearly patterns are only valid for a single day. Weekly patterns are only valid as the Or of the DayOfWeekMask. Can be one of or a sum of the following OlDaysOfWeek constants: olSunday, olMonday, olTuesday, olWednesday, olThursday, olFriday, or olSaturday. Read/write Long.


DefaultItemType Property

Returns the default Outlook item type contained in the folder. Can be one of the following OlItems constants: olAppointmentItem, olContactItem, olJournalItem, olMailItem, olNoteItem, olPostItem, or olTaskItem. Read-only Long.


DefaultMessageClass Property

Returns the default message class for items in the folder. Read-only String.


DeferredDeliveryTime Property

Returns or sets the date and time the mail message is to be delivered. This property corresponds to the MAPI property PR_DEFERRED_DELIVERY_TIME. Read/write Date.


DelegationState Property

Returns the delegation state of the task. Can be one of the following OlTaskDelegationState constants: olTaskDelegationAccepted, olTaskDelegationDeclined, olTaskDelegationUnknown or olTaskNotDelegated. Read-only Long.


Delegator Property

Returns the display name of the delegator for the task. Read-only String.


Delete Method

Deletes the object from the collection.

Syntax

expression.Delete

expression   An expression that returns an object in the Applies To list.


DeleteAfterSubmit Property

True if a copy of the mail message is not saved upon being sent. False if a copy is saved. Read/write Boolean.


Department Property

Returns or sets the department name for the contact. Read/write String.


Description Property

Returns or sets the description of the folder. Corresponds to the Description box in the Properties dialog box for the folder. This property corresponds to the MAPI property PR_COMMENT. Read/write String.


Display Method

MAPIFolder object: Displays a new Explorer object for the folder.

Outlook items: Displays a new Inspector object for the item.

Inspector and Explorer objects: Displays the existing inspector or explorer.

Syntax 1

expression.Display

Syntax 2

expression.Display(Modal)

expression   An expression that returns an Explorer or MAPIFolder object (Syntax 1) or an Outlook item or Inspector object (Syntax 2).

Modal   Optional Boolean. True to make the inspector modal. The default value is False.


Display Method Example

This example displays the default Inbox folder.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

myFolder.Display

This example displays the first item in the Inbox folder.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

myFolder.Items(1).Display


DocPosted Property

True if the journalized item was posted as part of the journalized session. Read/write Boolean.


DocPrinted Property

True if the journalized item was printed as part of the journalized session. Read/write Boolean.


DocRouted Property

True if the journalized item was routed as part of the journalized session. Read/write Boolean.


DocSaved Property

True if the journalized item was saved as part of the journalized session. Read/write Boolean.


DueDate Property

Returns or sets the due date for the task. Read/write Date.


Duration Property

Returns or sets the duration (in minutes) of the appointment, journal entry, or recurrence pattern. For recurrences, this property is only valid for appointments. Read/write Long.


Email1Address Property

Returns or sets the e-mail address of the first e-mail entry for the contact. Read/write String.


Email1Address Property Example

This example sets "Jsmith@msn.com" as the e-mail address for the first e-mail entry of a contact.

myItem.Email1Address = "Jsmith@msn.com"


Email1AddressType Property

Returns or sets the address type (such as EX or SMTP) of the first e-mail entry for the contact. This is free-form text field, but it must match the actual type of a existing mail transport. Read/write String.


Email1AddressType Property Example

This example sets "SMTP" as the address type for the first e-mail entry of a contact.

myItem.Email1AddressType = "SMTP"


Email1DisplayName Property

Returns the display name of the first e-mail address for the contact. This property is set to the value of the FullName property by default. Read-only String.


Email1EntryID Property

Returns the entry ID of the first e-mail address for the contact. Read-only String.


Email2Address Property

Returns or sets the e-mail address of the second e-mail entry for the contact. Read/write String.


Email2Address Property Example

This example sets "Jsmith@msn.com" as the e-mail address for the second e-mail entry of a contact.

myItem.Email2Address = "Jsmith@msn.com"


Email2AddressType Property

Returns or sets the address type (such as EX or SMTP) of the second e-mail entry for the contact. This is free-form text field, but it must match the actual type of a existing mail transport. Read/write String.


Email2AddressType Property Example

This example sets "SMTP" as the address type for the second e-mail entry of a contact.

myItem.Email2AddressType = "SMTP"


Email2DisplayName Property

Returns the display name of the second e-mail entry for the contact. This property is set to the value of the FullName property by default. Read-only String.


Email2EntryID Property

Returns the entry ID of the second e-mail entry for the contact. Read-only String.


Email3Address Property

Returns or sets the e-mail address of the third e-mail entry for the contact. Read/write String.


Email3Address Property Example

This example sets "Jsmith@msn.com" as the e-mail address for the third e-mail entry of a contact.

myItem.Email3Address = "Jsmith@msn.com"


Email3AddressType Property

Returns or sets the address type (such as EX or SMTP) of the third e-mail entry for the contact. This is free-form text field, but it must match the actual type of a existing mail transport. Read/write String.


Email3AddressType Property Example

This example sets "SMTP" as the address type for the third e-mail entry of a contact.

myItem.Email3AddressType = "SMTP"


Email3DisplayName Property

Returns the display name of the third e-mail entry for the contact. This property is set to the value of the FullName property by default. Read-only String.


Email3EntryID Property

Returns the entry ID of the third e-mail entry for the contact. Read-only String.


Enabled Property

True if the action is enabled in the application. Read/write Boolean.


End Property

Returns or sets the end date and time of an appointment or journal entry. Read/write Date.


EndTime Property

Returns or sets the end time for a recurrence pattern. This property is only valid for appointments Read/write Date.


EntryID Property

Returns the unique entry ID of the object. This property corresponds to the MAPI property PR_ENTRYID. MAPI systems assign a permanent, unique ID string when an object is created that does not change from one MAPI session to another. The EntryID property is not set for an Outlook item until it is saved or sent. Read-only String.


EntryID Property Example

This example compares the entry ID of one message to the entry ID of a message returned by a search operation to determine whether the objects represent the same message.

If myItem.EntryID = myFoundItem.EntryID Then

    MsgBox "These two message objects refer to the same message."

End If


Execute Method

Executes the action for the item. Returns the Outlook item created by the action.

Syntax

expression.Execute

expression   An expression that returns an Action object.


Execute Method Example

This example looks through the all the actions for the given mail message, and executes the action called "Reply to All."

For Each a In myItem.Actions

    If a.Name = "Reply to All" Then

        Set myItem2 = a.Execute

        Exit For

    End If

Next a


ExpiryTime Property

Returns or sets the date and time at which the mail message or post becomes invalid and can be deleted. Read/write Date.


FileAs Property

Returns or sets the default keyword string assigned to the contact when it is filed. Read/write String.


FindNext Method

After the Find method runs, this method finds and returns the next Outlook item in the collection. The search operation begins from the current position, which matches the expression previously set through Find.

Syntax

expression.FindNext

expression   An expression that returns an Items object.


FindNext Method Example

This example displays in a series of message boxes all the appointments occurring today.

tdystart = Format(Date, "Short Date") & " 12:00 AM"

tdyend = Format(Date, "Short Date") & " 11:59 PM"

Set myAppointments = olNameSpace.GetDefaultFolder _

    (olFolderCalendar).Items

Set currentAppointment = myAppointments.Find("[Start] >= """ & _

    tdystart & """ and [Start] <= """ & tdyend & """")

While TypeName(currentAppointment) <> "Nothing"

    MsgBox currentAppointment.Subject

    Set currentAppointment = myAppointments.FindNext

Wend


FirstName Property

Returns or sets the first name for the contact. Read/write String.

Remarks

This property is parsed from the FullName property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes of entries to FullName.


FlagDueBy Property

Returns or sets the date by which action on this mail message is due. This property is only valid if the FlagStatus property is also set for the message. This property corresponds to the MAPI property PR_REPLY_TIME. Read/write Date.


FlagRequest Property

Returns or sets the requested action for the mail message. This is a free-form text field. This property is only valid if the FlagStatus property is also set for the message. Read/write String.


FlagStatus Property

Returns or sets the flag status for the mail message. Can be one of the following OlFlagStatus constants: olFlagComplete, olFlagMarked, or olNoFlag. Read/write Long.


Folders Property

Returns the Folders collection that represents all the folders contained in the specified folder or name space. The NameSpace object is the root of all the folders for the given name space. Read-only.


FormDescription Property

Returns the FormDescription object that represents the form description for the Outlook item. Read-only.


Formula Property

Returns or sets the formula for the user property. Read/write String.


Forward Method

Executes the Forward action for the journal entry, mail message, or post. Returns the resulting copy as a new object.

Syntax

expression.Forward

expression   An expression that returns an item in the Applies To list.


Forward Method Example

This example retrieves the first message in the default Inbox folder and forwards it to Laura Jennings. It assumes that the name will resolve unambiguously in the Address Book.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

Set myForward = myFolder.Items(1).Forward

myForward.Recipients.Add "Laura Jennings"

myForward.Send


FTPSite Property

Returns the FTP site entry for the contact. Read/write String.


FullName Property

Returns or sets the whole, unparsed full name for the contact. Read/write String.

Remarks

This property is parsed into the FirstName, LastName, and MiddleName properties, which may be changed or entered independently should they be parsed incorrectly. Note that any such changes or entries to the FirstName, LastName, or MiddleName properties will be overwritten by any subsequent changes or entries to FullName.


FullNameAndCompany Property

Returns the full name and company of the contact by concatenating the values of the FullName and CompanyName properties. Read-only String.


Gender Property

Returns or sets the gender of the contact. Can be one of the following OlGender constants: olFemale, olMale, or olUnspecified. Read/write Long.


GetAssociatedAppointment Method

Returns an AppointmentItem object that represents the appointment associated with the meeting request.

Syntax

expression.GetAssociatedAppointment(AddToCalendar)

expression   An expression that returns a MeetingRequestItem object.

AddToCalendar   Required Boolean. True to add the meeting to the default Calendar folder.


GetAssociatedAppointment Method Example

This example finds a meeting request in the default Inbox folder and adds the associated appointment to the Calendar folder.

Set myFolder = _

    olNameSpace.GetDefaultFolder(olFolderInbox)

Set myMtgReq = myFolder.Items.Find("[MessageClass] = _

    'IPM.Schedule.Meeting.Request'")

If TypeName(myMtgReq) <> "Nothing" Then

   Set myAppt = myMtgReq.GetAssociatedAppointment(True)

End If

This example accepts a meeting request, sending the response without displaying the inspector.

Set myNewMeeting =myMtgReq.GetAssociatedAppointment(True)

myNewMeeting.Respond olResponseAccepted, True


GetAssociatedTask Method

Returns a TaskItem object that represents the requested task.

Syntax

expression.GetAssociatedTask(AddToTaskList)

expression   An expression that returns a TaskRequestItem object.

AddToTaskList   Required Boolean. True if the task is added to the default Tasks folder.


GetAssociatedTask Method Example

This example accepts a task request, sending the response without displaying the inspector.

Set myNewTask = myTaskRequest.GetAssociatedTask(True)

myNewTask.Respond olResponseAccepted, True


GetDefaultFolder Method

Returns a MAPIFolder object that represents the default folder of the requested type for the current profile (for example, obtaining the default Calendar folder for the user who is currently logged on).

Syntax

expression.GetDefaultFolder(FolderTypeEnum)

expression   An expression that returns a NameSpace object.

FolderTypeEnum   Required Long. The type of default folder to return. Can be one of the following OlDefaultFolders constants: olFolderCalendar, olFolderContacts, olFolderDeletedItems, olFolderInbox, olFolderJournal, olFolderNotes, olFolderOutbox, olFolderSentMail, or olFolderTasks.


GetDefaultFolder Method Example

This example obtains the default Calendar folder for the current user.

set myCalendar = olNameSpace.GetDefaultFolder(olFolderCalendar)


GetFolderFromID Method

Returns a MAPIFolder object identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.

Syntax

expression.GetFolderFromID(EntryIDFolder, EntryIDStore)

expression   An expression that returns a NameSpace object.

EntryIDFolder   Required String. The entry ID of the folder.

EntryIDStore   Optional String. The entry id of the store containing the folder.


GetItemFromID Method

Returns an Outlook item identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.

Syntax

expression.GetItemFromID(EntryIDItem, EntryIDStore)

expression   An expression that returns a NameSpace object.

EntryIDItem   Required String. The entry ID of the item.

EntryIDStore   Optional String. The entry ID of the store containing the item.


GetNameSpace Method

Returns a NameSpace object of the specified type.

Syntax

expression.GetNameSpace(Type)

expression   An expression that returns a Application object.

Type   Required String. The type of name space to return.

Remarks

The only supported name space type is "MAPI."


GetNameSpace Method Example

This example obtains the MAPI NameSpace object.

set myOlApp = CreateObject ("Outlook.Application")

Set olNameSpace = myOlApp.GetNameSpace("MAPI")


GetRecipientFromID Method

Returns a Recipient object identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.

Syntax

expression.GetRecipientFromID(EntryID)

expression   An expression that returns a NameSpace object.

EntryID   Required String. The entry ID of the recipient.


GetRecurrencePattern Method

Returns a RecurrencePattern object that represents the recurrence attributes of an appointment or task. If there is no existing recurrence pattern, a new, empty RecurrencePattern object is returned.

Syntax

expression.GetRecurrencePattern

expression   An expression that returns an AppointmentItem or TaskItem object.


GetRecurrencePattern Method Example

This example obtains the recurrence pattern for an appointment.

Set myPattern = myAppointment.GetRecurrencePattern


GovernmentIDNumber Property

Returns or sets the government ID number for the contact. Read/write String.


HasAttachment Property

True if  the remote item has an attachment associated with it. The default value is True. Read-only Boolean.


Height Property

Returns or sets the height (in pixels) of the note. Read/write Long.


HideFormPage Method

Hides a form page in the inspector.

Syntax

expression.HideFormPage(PageName)

expression   An expression that returns an Inspector object.

Index   Required String. The display name of the page to be hidden.


Hobby Property

Returns or sets the hobby for the contact. Read/write String.


Home2TelephoneNumber Property

Returns or sets the second home telephone number for the contact. Read/write String.


HomeAddress Property

Returns or sets the full, unparsed text of the home address for the contact. Read/write String.


HomeAddressCity Property

Returns or sets the city portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeAddressCountry Property

Returns or sets the country portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeAddressPostalCode Property

Returns or sets the postal code portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeAddressPostOfficeBox Property

Returns or sets the post office box number portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeAddressState Property

Returns or sets the state portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeAddressStreet Property

Returns or sets the street portion of the home address for the contact. Read/write String.

Remarks

This property is parsed from the HomeAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to HomeAddress.


HomeFaxNumber Property

Returns or sets the home fax number for the contact. Read/write String.


HomeTelephoneNumber Property

Returns or sets the first home telephone number for the contact. Read/write String.


Icon Property

Returns or sets the file name of the icon to be displayed for the form. Read/write String.


Importance Property

Returns or sets the relative importance level for the Outlook item. Can be one of the following OlImportance constants: olImportanceHigh, olImportanceLow, or olImportanceNormal. This property corresponds to the MAPI property PR_IMPORTANCE. Read/write Long.


Initials Property

Returns or sets the initials for the contact. Read/write String.


Interval Property

Returns or sets the number of units of a given recurrence type between occurrences. For example, setting the Interval property to 2 and the RecurrenceType property to "Weekly" would cause the pattern to occur every second week. Read/write Long.

Note   This property is not valid for yearly recurrence patterns.


ISDNNumber Property

Returns or sets the ISDN number for the contact. Read/write String.


IsRecurring Property

True if the appointment or task is a recurring appointment or task. When the GetRecurrencePattern property is used with an AppointmentItem or TaskItem object, this property is set to True. Read-only Boolean.


Items Property

Returns the collection of Outlook items in the folder. Read-only.


Items Property Example

This example obtains the collection of MailItem objects from the default Inbox folder.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

Set myItems = myFolder.Items


JobTitle Property

Returns or sets the job title for the contact. Read/write String.


Journal Property

True if the transaction of the contact will be journalized. The default value is False. Read/write Boolean.


Language Property

Returns or sets the language for the contact. Read/write String.


LastModificationTime Property

Returns the time the Outlook item was last modified. This property corresponds to the MAPI property PR_LAST_MODIFICATION_TIME. Read-only Date.


LastName Property

Returns or sets the last name for the contact. Read/write String.

Remarks

This property is parsed from the FullName property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes of entries to FullName.


LastNameAndFirstName Property

Returns the concatenated last name and first name for the contact. Read-only String.

Remarks

This property is parsed from the FirstName and LastName properties for the contact, which are themselves parsed from the FullName property.


Left Property

Returns or sets the position (in pixels) of the left vertical edge of the note. Read/write Long.


Locked Property

True if the form may be modified. Read/write Boolean.


Logoff Method

Logs the user off from the current MAPI session.

Syntax

expression.Logoff

expression   An expression that returns a NameSpace object.


Logon Method

Logs the user on to MAPI, obtaining a MAPI session.

Syntax

expression.Logon(Profile, Password, ShowDialog, NewSession)

expression   An expression that returns a NameSpace object.

Profile   Optional String. The profile name to use for the session.

Password   Optional String. The password (if any) associated with the profile.

ShowDialog   Optional Boolean. True to display the MAPI logon dialog.

NewSession   Optional Boolean. True to create a new session (doesn't use an existing session).


MailingAddress Property

Returns or sets the full, unparsed selected mailing address for the contact. Read/write String.

Remarks

This property replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While it can be changed or entered independently, any such changes or entries to this property will be overwritten by any subsequent changes or entries to the property indicated by SelectedMailingAddress.


MailingAddressCity Property

Returns or sets the city name portion of the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


MailingAddressCountry Property

Returns or sets the country code portion of the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


MailingAddressPostOfficeBox Property

Returns or sets the post office box number portion of the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


MailingAddressPostalCode Property

Returns or sets the postal code portion of the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


MailingAddressState Property

Returns or sets the state code portion for the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


MailingAddressStreet Property

Returns or sets the street address portion of the selected mailing address of the contact. Read/write String.

Remarks

This property is parsed from the MailingAddress property, which in turn replicates the property indicated by the SelectedMailingAddress property, which is one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther. While can be changed or entered independently should it be parsed incorrectly, any such changes or entries to this property will be overwritten by any subsequent changes or entries to either MailingAddress or to the property indicated by SelectedMailingAddress.


ManagerName Property

Returns or sets the manager name for the contact. Read/write String.


MarkComplete Method

Marks the task as completed. Sets PercentComplete to "100%", Complete to True, and DateCompleted to the current date.

Syntax

expression.MarkComplete

expression   An expression that returns a TaskItem object.


MeetingStatus Property

Returns or sets the meeting status of the appointment. Use this property to make a MeetingRequestItem object available for the appointment. Can be one of the following OlMeetingStatus constants: olMeeting, olMeetingCanceled, olMeetingReceived, or olNonMeeting. Read/write Long.


MessageClass Property

Returns or sets the message class for the Outlook item or Action. This property corresponds to the MAPI property PR_MESSAGE_CLASS. Read/write String.


MiddleName Property

Returns or sets the middle name for the contact. Read/write String.

Remarks

This property is parsed from the FullName property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes of entries to FullName.


Mileage Property

Returns or sets the mileage for the appointment, contact, or task. This is a free-form string field and can be used to store mileage information associated with the item (for example, 100 miles documented for a task) for purposes of reimbursement. Read/write String.


MiniIcon Property

Returns or sets the file name of the mini-icon to be displayed for the form. Read/write String.


MobileTelephoneNumber Property

Returns or sets the mobile telephone number for the contact. Read/write String.


ModifiedFormPages Property

Returns the Pages collection that represents all the pages for the item in the inspector. The main page and up to a 3 customizable pages can be obtained using the Add method. Read-only.


MonthOfYear Property

Returns or sets which month of the year is valid for this recurrence pattern. Can be a number from 1 through 12. For example, setting this property to 5 and the RecurrenceType property to olRecursYearly would cause this recurrence pattern to occur every May. Read/write Long.

Note   This property is only valid for recurrence patterns whose RecurrenceType property is set to olRecursYearly or olRecursYearNth.


Move Method

Moves an Outlook item to a new folder.

Syntax

expression.Move(DestFldr)

expression   An expression that returns an object in the Applies To list.

DestFldr   Required MAPIFolder. The destination folder.


MoveTo Method

Moves the current folder to the specified destination folder.

Syntax

expression.MoveTo(DestFldr)

expression   An expression that returns a MAPIFolder object.

DestFldr   Required MAPIFolder. The folder to add the moved folder to.


MoveTo Method Example

This example adds a new folder to the default Contacts folder, and then moves it to the default Inbox folder.

Set myFolder = olNameSpace.GetDefaultFolder(olFolderContacts)

Set myNewFolder = myFolder.Folders.Add("My Contacts")

myNewFolder.MoveTo olNameSpace.GetDefaultFolder(olFolderInbox)


Name Property

Returns the display name for the object. Read-only String for Recipient and UserProperty objects, read/write String for Action, FormDescription, and MAPIFolder objects.


NickName Property

Returns or sets the nickname for the contact. Read/write String.


NoAging Property

True to not to age the Outlook item. Read/write Boolean.


NoEndDate Property

True if the recurrence pattern has no end date. Read/write Boolean.

Remarks

This property must be coordinated with other properties when setting up a recurrence pattern. If the PatternEndDate property or the Occurrences property is set, the pattern is considered to be finite and the NoEndDate property is False. If neither PatternEndDate nor Occurrences is set, the pattern is considered infinite and NoEndDate is True.


Number Property

Returns or sets the number for the form. Read/write String.


Occurrences Property

Returns or sets the number of occurrences of the recurrence pattern. This property allows the definition of a recurrence pattern that is only valid for the specified number of subsequent occurrences. For example, you can set this property to 10 for a formal training course that will be held on the next ten Thursday evenings. Read/write Long.

Remarks

This property must be coordinated with other properties when setting up a recurrence pattern. If the PatternEndDate property or the Occurrences property is set, the pattern is considered to be finite and the NoEndDate property is False. If neither PatternEndDate nor Occurrences is set, the pattern is considered infinite and NoEndDate is True.


OneOff Property

True if the form will be discarded after using once (one-off). False if the form is retained as a custom form. Read/write Boolean.


OptionalAttendees Property

Returns the display string of optional attendees names for the appointment. This property corresponds to the MAPI property PR_DISPLAY_CC. Read-only String.


Ordinal Property

Returns or sets the position in the view (ordinal) for the task. Read/write Long.


OrganizationalIDNumber Property

Returns or sets the organizational ID number for the contact. Read/write String.


OriginatorDeliveryReportRequested Property

True if the originator requested a delivery receipt on the mail message. Read/write Boolean.


OtherAddress Property

Returns or sets the other address for the contact. Read/write String.

Remarks

This property contains the full, unparsed other address for the contact.


OtherAddressCity Property

Returns or sets the city portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherAddressCountry Property

Returns or sets the country portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherAddressPostalCode Property

Returns or sets the postal code portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherAddressPostOfficeBox Property

Returns or sets the post office box portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherAddressState Property

Returns or sets the state portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherAddressStreet Property

Returns or sets the street portion of the other address for the contact. Read/write String.

Remarks

This property is parsed from the OtherAddress property, but may be changed or entered independently should it be parsed incorrectly. Note that any such changes or entries to this property will be overwritten by any subsequent changes or entries to OtherAddress.


OtherFaxNumber Property

Returns or sets the other fax number for the contact. Read/write String.


OtherTelephoneNumber Property

Returns or sets the other telephone number for the contact. Read/write String.


Owner Property

Returns or sets the owner for the task. This is a free form string field. Setting this property to someone other than the current user does not have the effect of delegating the task; use the CreateTaskRequest method for this purpose. Read/write String.


Ownership Property

Returns the ownership state of the task. Can be one of the following OlTaskOwnership constants: olDelegatedTask, olNewTask, or olOwnTask. Read-only Long.


PagerNumber Property

Returns or sets the pager number for the contact. Read/write String.


Parent Property

Returns the parent object of the specified object. Read-only.


Password Property

Returns or sets the password for modifying the form. Read/write String.


PathName Property

Returns the full path to the linked attached file. This property is only valid for linked files. Read-only String.


PatternEndDate Property

Returns or sets the end date for the recurrence pattern. Read/write Date.

Remarks

This property is optional but must be coordinated with other properties when setting up a recurrence pattern. If this property or the Occurrences property is set, the pattern is considered to be finite, and the NoEndDate property is False. If neither PatternEndDate or Occurrences is set, the pattern is considered infinite and NoEndDate is True.


PatternStartDate Property

Returns or sets the start date for the recurrence pattern. Read/write Date.


PercentComplete Property

Returns or sets the percentage of the task completed at the current date and time. Read/write Long.


PersonalHomePage Property

Returns or sets the URL of the personal Web page for the contact. Read/write String.


Position Property

Returns or sets the position of the attachment within the body of the item. Read/write Long.


Prefix Property

Returns or sets the prefix (for example, "Re") to use with the subject of the item when the action is executed. Note that Outlook automatically adds a colon (:) to the value of the Prefix property when setting the subject of the item. Read/write String.


PrimaryTelephoneNumber Property

Returns or sets the primary telephone number for the contact. Read/write String.


PrintOut Method

Prints the Outlook item using all default settings.

Syntax

expression.PrintOut

expression   An expression that returns an object in the Applies To list.


Profession Property

Returns or sets the profession for the contact. Read/write String.


RadioTelephoneNumber Property

Returns or sets the radio telephone number for the contact. Read/write String.


ReadReceiptRequested Property

True if a read receipt has been requested by the sender. This property corresponds to the MAPI property PR_READ_RECEIPT_REQUESTED. Read/write Boolean.


ReceivedByEntryID Property

Returns the entry ID for the true recipient as set by the transport provider delivering the mail message. This property corresponds to the MAPI property PR_RECEIVED_BY_ENTRYID. Read-only String.


ReceivedByName Property

Returns display name of the true recipient for the mail message. This property corresponds to the MAPI property PR_RECEIVED_BY_NAME. Read-only String.


ReceivedOnBehalfOfEntryID Property

Returns the entry ID of the user delegated to represent the recipient for the mail message. This property corresponds to the MAPI property PR_RCVD_REPRESENTING_ENTRYID. Read-only String.


ReceivedOnBehalfOfName Property

Returns the display name of the user delegated to represent the recipient for the mail message. This property corresponds to the MAPI property PR_RCVD_REPRESENTING_NAME. Read-only String.


ReceivedTime Property

Returns or sets the date and time at which the mail message or post was received. Read/write Date.


RecipientReassignmentProhibited Property

True if the recipient cannot forward the mail message. Read/write Boolean.


Recipients Property

Returns a Recipients collection that represents all the recipients for the Outlook item. Read-only.


RecurrenceType Property

Returns or sets the frequency of occurrences for the recurrence pattern. Can be one of the following OlRecurrenceType constants: olRecursDaily, olRecursWeekly, olRecursMonthly, olRecursMonthNth, olRecursYearly, or olRecursYearNth. Use the Interval property to specify the number of units of a given recurrence type between occurrences in the pattern Read/write Long.


ReferredBy Property

Returns or sets the referral name entry for the contact. Read/write String.


ReminderMinutesBeforeStart Property

Returns or sets the number of minutes the reminder should occur prior to the start of the appointment or task. Read/write Long.


ReminderOverrideDefault Property

True if the reminder overrides the default reminder behavior for the appointment or task. Read/write Boolean.


ReminderPlaySound Property

True if the reminder should play a sound when it occurs for this appointment or task. This property is only valid if the ReminderOverrideDefault property is set to True. Read/write Boolean.


ReminderSet Property

True if a reminder has been set for this appointment or task. Read/write Boolean.


ReminderSoundFile Property

Returns or sets the path and filename of the sound file to play when the reminder occurs for the appointment or task. This property is only valid if the ReminderOverrideDefault and ReminderPlaySound properties are set to True. Read/write String.


ReminderTime Property

Returns or sets the date and time at which the reminder should occur for this appointment or task. Read/write Date.


RemoteMessageClass Property

Returns the message class for the remote item. Read-only String.


RemoteStatus Property

Returns or sets the remote status of the mail message. Can be one of the following OlRemoteStatus constants: olMarkedForCopy, olMarkedForDelete, olMarkedForDownload, olNone, or olUnMarked. Read/write Long.


Remove Method

Removes the object from the collection.

Syntax

expression.Remove(Index)

expression   An expression that returns an object in the Applies To list.

Index   Required Long. The index of the object within the collection.


Reply Method

Creates a reply, pre-addressed to the original sender, from the journal entry or mail message. Returns the reply as a MailItem object.

Syntax

expression.Reply

expression   An expression that returns a JournalItem or MailItem object.


ReplyAll Method

Creates a reply to all original recipients from the journal entry or mail message. Returns the reply as a MailItem object.

Syntax

expression.ReplyAll

expression   An expression that returns a JournalItem or MailItem object.


ReplyRecipientNames Property

Returns the semicolon-delimited list of reply recipients for the mail message. This property only contains the display names for the reply recipients. The reply recipients list should be set by using the ReplyRecipients collection. Read-only String.


ReplyRecipients Property

Returns a Recipients collection that represents all the reply recipient objects for the mail message. Read-only Recipients.


ReplyStyle Property

Returns or sets the text formatting reply style for the action. Can be one of the following OlActionReplyStyle constants: olEmbedOriginalItem, olIncludeOriginalText, olIndentOriginalText, or olOmitOriginalText. Read/write Long.


ReplyTime Property

Returns or sets the reply time for the appointment. Read/write Date.


RequiredAttendees Property

Returns the semicolon-delimited string of required attendee names for the meeting appointment. This property only contains the display names for the required attendees. The attendee list should be set by using the Recipients collection. Read/write String.


Resolve Method

Attempts to resolve a Recipient object. Returns True if the object was resolved, False if it was not.

Syntax

expression.Resolve

expression   An expression that returns a Recipient object.


ResolveAll Method

Attempts to resolve all the Recipient objects in the Recipients collection. Returns True if all of the objects were resolved, False if one or more were not.

Syntax

expression.ResolveAll

expression   An expression that returns a Recipients object.


Resolved Property

True if the recipient has been validated against the Address Book. Read-only Boolean.


Resources Property

Returns the semicolon-delimited string of resource names for the meeting. This property contains the display names only. The Recipients collection should be used to modify the resource recipients. Resources are added as BCC recipients to the collection. Read/write String.


ResponseRequested Property

True if the sender would like a response to the meeting request for the appointment. Read/write Boolean.


ResponseStatus Property

Returns or sets the overall status of the meeting for the current user for the appointment. Can be one of the following OlResponseStatus constants: olResponseAccepted, olResponseDeclined, olResponseNone, olResponseNotResponded, olResponseOrganized, or olResponseTentative. Read/write Long.


ResponseStyle Property

Returns or sets the response style used when the action is executed. Can be one of the following OlActionResponseStyle constants: olOpen, olPrompt, or olSend. Read/write Long.


Save Method

Saves the Outlook item to the current folder or, if this is a new item, to the Outlook default folder for the item type.

Syntax

expression.Save

expression   An expression that returns an object in the Applies To list.


SaveAsFile Method

Saves the attachment to the specified path.

Syntax

expression.SaveAsFile(Path)

expression   An expression that returns an Attachment object.

Path   Required String. The location to save the attachment.


Saved Property

True if the Outlook item has not been modified since the last save. Read-only Boolean.


SaveSentMessageFolder Property

Returns or sets the MAPIFolder object that represents the folder in which a copy of the mail message will be saved upon being sent. Read/write.


SchedulePlusPriority Property

Returns or sets the Microsoft Schedule+ priority for the task. Can be 1 through 9, A through Z, or A1 through Z9. Priority 1 is the highest. The default value is 3. Read/write String.


SelectedMailingAddress Property

Returns or sets the type of the mailing address for the contact. Can be one of the following OlMailingAddress constants: olBusiness, olHome, olNone, or olOther.Read/write Long.


Send Method

Sends the appointment, mail message, or task.

Syntax

expression.Send

expression   An expression that returns an AppointmentItem, MailItem, or TaskItem object.


SenderName Property

Returns the display name of the sender for the mail message or post. This property corresponds to the MAPI property PR_SENDER_NAME. Read-only String.


Sensitivity Property

Returns or sets the sensitivity for the Outlook item. Can be one of the following OlSensitivity constants: olConfidential, olNormal, olPersonal, or olPrivate. This property corresponds to the MAPI property PR_SENSITIVITY. Read/write Long.


SentOn Property

Returns the date on which the mail message or post was sent. This property corresponds to the MAPI property PR_CLIENT_SUBMIT_TIME. Read-only Date.


SentOnBehalfOfName Property

Returns the display name for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_NAME. Read-only String.


ShowFormPage Method

Shows a form page in the inspector.

Syntax

expression.ShowFormPage(PageName)

expression   An expression that returns an Inspector object.

PageName   Required String. The display name of the page to be shown.


ShowOn Property

Returns or sets the location where the action will be shown. Can be one of the following OlActionShowOn constants: olDontShow, olMenu, or olMenuAndToolbar. Read/write Long.


Size Property

Returns the size (in bytes) of the Outlook item. Read-only Long.


Spouse Property

Returns or sets the spouse name entry for the contact. Read/write String.


Start Property

Returns or sets the starting date and time for the appointment or journal entry. Read/write Date.


StartDate Property

Returns or sets the starting date and time for the task. Read/write Date.


StartTime Property

Returns or sets the start time for a given occurrence of the recurrence pattern. This property is only valid for appointments. Read/write Date.


Status Property

Returns or sets the status for the task. Can be one of the following OlTaskStatus constants: olTaskComplete, olTaskDeferred, olTaskInProgress, olTaskNotStarted, or olTaskWaiting. Read/write Long.


StatusOnCompletionRecipients Property

Returns the semicolon-delimited string of display names for recipients who will receive status upon completion of the task. This property is calculated from the Recipients property. Recipients returned by the StatusOnCompletion property correspond to BCC recipients in the Recipients collection. Read-only String.


StatusReport Method

Sends a status report to all CC recipients (recipients returned by the StatusUpdateRecipients property) with the current status for the task.

Syntax

expression.StatusReport

expression   An expression that returns a TaskItem object.


StatusUpdateRecipients Property

Returns the semicolon-delimited string of display names for recipients who receive status updates for the task. This property is calculated from the Recipients property. Recipients returned by the StatusUpdateRecipients property correspond to CC recipients in the Recipients collection. Read-only String.


StoreID Property

Returns or sets the store ID for the folder. Read-only String.


Subject Property

Returns or sets the subject for the Outlook item. This property corresponds to the MAPI property PR_SUBJECT. Read/write String.

Note   The Subject property is the default property for Outlook items.


Suffix Property

Returns or sets the name suffix (such as Jr., III, or Ph.D.) for the contact. Read/write String.


TeamTask Property

True if the task is a team task. Read/write Boolean.


TelexNumber Property

Returns or sets the telex number for the contact. Read/write String.


Template Property

Returns or sets the name of the template for the form. Read/write String.


Title Property

Returns or sets the title for the contact. Read/write String.


To Property

Returns the semicolon-delimited list of display names for the To recipients for the Outlook item. This property contains the display names only. The Recipients collection should be used to modify this property. Read-only String.

Remarks

This property corresponds to the MAPI property PR_DISPLAY_TO.


Top Property

Returns or sets the position (in pixels) of the top horizontal edge of the note. Read/write Long.


TotalWork Property

Returns or sets the total work for the task. Read/write Long.


TrackingStatus Property

Returns or sets the tracking status for the recipient. Can be one of the following OlTrackingStatus constants: olTrackingDelivered, olTrackingNone, olTrackingNotDelivered, olTrackingNotRead, olTrackingRead, olTrackingRecallFailure, olTreackingRecallSuccess, or olTrackingReplied. Read/write Long.


TrackingStatusTime Property

Returns or sets the tracking status date and time for the recipient. Read/write Date


TransferSize Property

Returns the transfer size (in bytes) for the remote item. Read-only Long.


TransferTime Property

Returns the transfer time (in seconds) for the remote item. Read-only Long.


TTYTDDTelephoneNumber Property

Returns or sets the TTY/TDD telephone number for the contact. Read/write String.


Type Property

Returns or sets the type of the object, as shown in the following table.

Object	Type
Attachment	Can be one of the following OlAttachmentType constants: olByReference, olByValue, olEmbeddedItem, or olOLE. Read-only Long.
JournalItem	A free-form string field, usually containing the display name of the journalizing application (for example, "MSWord"). Read/write String.
NameSpace	The only supported type is "MAPI." Read-only String.
Recipient (of JournalItem)	The OlJournalRecipientType constant: olAssociatedContact. Read/write Long.
Recipient (of MailItem)	Can be one of the following OlMailRecipientType constants: olBCC, olCC, olOriginator, or olTo. Read/write Long.
Recipient (of MeetingRequestItem)	Can be one of the following OlMeetingRecipientType constants: olOptional, olOrganizer, olRequired, or olResource. Read/write Long.
Recipient (of TaskItem)	Can be either of the following OlTaskRecipientType constants: olFinalStatus, or olUpdate. Read/write Long.
UserProperty	Can be one of the following OlUserPropertyType constants: olCombination, olCurrency, olDateTime, olDuration, olFormula, olKeywords, olNumber, olPercent, olText, or olYesNo. Read-only Long.


UnRead Property

True if the Outlook item has not been opened (read). Read/write Boolean.


UnReadItemCount Property

Returns the number of unread items in the folder. Read-only Long.


User1 Property

Returns or sets the first Microsoft Schedule+ user for the contact. Read/write String.


User2 Property

Returns or sets the second Microsoft Schedule+ user for the contact. Read/write String.


User3 Property

Returns or sets the third Microsoft Schedule+ user for the contact. Read/write String.


User4 Property

Returns or sets the fourth Microsoft Schedule+ user for the contact. Read/write String.


UserProperties Property

Returns the UserProperties collection that represents all the user properties for the Outlook item. Read-only.


UseWordMail Property

True to use Microsoft Word as the default editor for the form. Read/write Boolean.


ValidationFormula Property

Returns or sets the validation formula for the user property. This property is just a descriptive string; it does not have any validation functionality. Read/write String.


ValidationText Property

Returns or sets the validation text for the user property. Read/write String.


Value Property

Returns or sets the value for the user property. Read/write Variant.


Actions Property

Returns a Actions collection that represents all the available actions for the Outlook item. Read-only.


Version Property

Returns or sets the number of the version for the form. Read/write String.


VotingOptions Property

Returns or sets a delimited string containing the voting options for the mail message. Read/write String.


VotingResponse Property

Returns or sets the voting response for the mail message. This property is usually set to one of the delimited values returned by the VotingOptions property on a reply to the original message. Read/write String.


WebPage Property

Returns or sets the URL of the Web page for the contact. Read/write String.


Width Property

Returns or sets the width (in pixels) for the note. Read/write Long.


YomiCompanyName Property

Returns or sets the Japanese phonetic rendering (yomigana) of the company name for the contact. Read/write String.


YomiFirstName Property

Returns or sets the Japanese phonetic rendering (yomigana) of the first name for the contact. Read/write String.


YomiLastName Property

Returns or sets the Japanese phonetic rendering (yomigana) of the last name for the contact. Read/write String.


FormDescription Object

Contains the general properties of an Outlook form. The properties of an Outlook form are displayed on the Properties page of a form in design mode. To see the Properties page in design mode, open the Outlook item, click Design Outlook Form on the Tools menu, and then click the Properties tab in item's window.

Using the FormDescription Object

Use the FormDescription property to return the FormDescription object associated with an Outlook item.


PostItem Object

Represents a post in a public folder that others may browse. Unlike a MailItem object, a PostItem object is not sent to a recipient. You use the Post method, which is analogous to Send method for the MailItem object, to save the PostItem to the target public folder instead of mailing it.

Using the PostItem Object

Use the CreateItem method to create a PostItem object that represents a new post. The following example returns a new post.

Set myItem = myOlApp.CreateItem(olPostItem)

Use Items(index), where index is the index number of a post or a value used to match the default property of a post, to return a single PostItem object from a public folder.


RemoteItem Object

Represents an remote item in an Inbox (mail) folder. The RemoteItem object is similar to the MailItem object, but it contains only the Subject, Received Date and Time, Sender, Size and the first 256 characters of the body of the message. It is used to give someone connecting in remote mode enough information to decide whether or not to download the corresponding mail message.

Using the RemoteItem Object

Unlike other Outlook objects, you cannot create this object. Remote items are created by Outlook automatically when you use a Remote Access System (RAS) connection. Each RemoteItem created on the local system corresponds to a pre-existing MailItem on the remote system.


ReportItem Object

Represents a mail-delivery report in an Inbox (mail) folder. The ReportItem object is similar to a MailItem object, and it contains a report (usually the non-delivery report) or error message from the mail transport system.

Using the ReportItem Object

Unlike other Outlook objects, you cannot create this object. Report items are created automatically when any report or error in general is received from the mail transport system.


Assign Method

Assigns a task and returns a TaskItem object that represents it. This method allows a task to be assigned (delegated) to another user. You must create a task before you can assign it, and you must assign a task before you can send it. An assigned task is sent as a TaskRequestItem object.

Syntax

expression.Assign

expression   An expression that returns a TaskItem object.


CancelResponseState Method

Resets an unsent response to a task request back to a simple task. After you receive a task request and respond to it, but before sending the response, you can use this method to revert the task to its state before you responded.

Syntax

expression.CancelResponseState

expression   An expression that returns a TaskItem object.


ClearConversationIndex Method

Clears the index of the conversation thread for the mail message or post.

Syntax

expression.ClearConversationIndex

expression   An expression that returns a MailItem or PostItem object.


Close Method

Explorer object: Closes the explorer. No information is saved.

Inspector or Outlook item object: Closes the inspector or item and optionally saves changes to the displayed Outlook item.

Syntax 1

expression.Close

Syntax 2

expression.Close(SaveMode)

expression   An expression that returns an Explorer object (Syntax 1) or an Inspector or Outlook item object (Syntax 2).

SaveMode   Required Long. The close behavior. Can be one of the following OlInspectorClose constants: olDiscard (discard all changes without prompting), olPromptForSave (prompt to save or discard all changes), or olSave (save all changes without prompting). The default value is olDiscard. If the item displayed within the inspector has not been changed, this argument has no effect.


Post Method

Sends (posts) the PostItem object. The Post method, which is analogous to Send method for the MailItem object, is used to save the post to the target public folder instead of mailing it.

Syntax

expression.Post

expression   An expression that returns an PostItem object.


PublishForm Method

Saves the definition of the FormDescription object in the specified form registry. Forms are registered as one of three classes: Folder, Organization, or Personal. The Folder form registry holds a set of forms that are only accessible from that specific folder, whether public or private. The Organization form registry holds forms that are shared across an entire enterprise and thus are accessible to everyone. The Personal form registry holds forms that are accessible only to the current store user.

Syntax

expression.PublishForm(Registry, Folder)

expression   An expression that returns a FormDescription object.

Registry   Required Long. The form class. Can be one of the following OlFormRegistry constants: olDefaultRegistry, olFolderRegistry, olOrganizationRegistry, or olPersonalRegistry. Use olDefaultRegistry to handle items without regard to their form class.

Folder   Required MAPIFolder. Used only with Folder form registry. The folder object from which the forms must be accessed.


Quit Method

Closes all currently open windows. The associated Outlook session is closed completely: the user is logged out of MAPI and any changes to items not already saved are discarded.

Syntax

expression.Quit

expression   An expression that returns an Application object.


SaveAs Method

Saves the Outlook item to the specified path and in the format of the specified file type. If the file type is not specified, the MSG format is used.

Syntax

expression.SaveAs(Path, Type)

expression   An expression that returns an Outlook item object.

Path   Required String. The path on which to save the item.

Type   Optional Variant. The file type to save. Can be one of the following OlSaveAsType constants: olDoc, olMSG, olRTF, olTemplate, or olTXT.


SetCurrentFormPage Method

Displays the specified form page in the inspector.

Syntax

expression.SetCurrentFormPage(PageName)

expression   An expression that returns an Inspector object.

PageName   Required String. The display name of the form page.


SkipRecurrence Method

Clears the current instance of a recurring task and sets the recurrence to the next instance of that task.

Syntax

expression.SkipRecurrence

expression   An expression that returns a TaskItem object.


StartTimer Method

Starts the timer on the journal entry. This method allows programmatic control of the timer function. The Duration, End and Start properties are automatically updated when the timer is stopped.

Syntax

expression.StartTimer

expression   An expression that returns an JournalItem object.


StopTimer Method

Stops the timer on the journal entry. This method allows programmatic control of the timer function. The Duration, End and Start properties are automatically updated when the timer is stopped.

Syntax

expression.StopTimer

expression   An expression that returns an JournalItem object.


AutoForwarded Property

True if the mail message was automatically forwarded. Read/write Boolean.


FileName Property

Returns the file name of the attachment. Use this property in conjunction with the PathName property. Read-only String.


Location Property

Returns or sets the specific office location (for example, Building 1 Room 1 or Suite 123) for the appointment. This property corresponds to the MAPI property PR_OFFICE_LOCATION. Read/write String.


MeetingResponseStatus Property

Returns or sets the overall status of the response to the meeting request for the recipient. Can be one of the following OlResponseStatus constants: olResponseAccepted, olResponseDeclined, olResponseNone, olResponseNotResponded, olResponseOrganized, or olResponseTentative. Read/write Long.


OfficeLocation Property

Returns or sets the specific office location (for example, Building 1 Room 1 or Suite 123) for the contact. This property corresponds to the MAPI property PR_OFFICE_LOCATION. Read/write String.


OutlookInternalVersion Property

Returns the build number of the Outlook application for an Outlook item. Read-only String.


OutlookVersion Property

Returns the major and minor version number of the Outlook application for an Outlook item. Read-only String.


ResponseState Property

Returns or sets the overall status of the response to the task request. Can be one of the following OlTaskResponse constants: olTaskAccept, olTaskAssign, olTaskDecline, or olTaskSimple. Read/write Long.


Role Property

Returns or sets the free-from text string associating the owner of a task with a role for the task. Read/write String.


UserCertificate Property

Returns or sets the string containing the user's authentication certificate for the contact. Read/write String.


Close Event

Occurs when the inspector associated with an Outlook item is being closed. If you set the return value of this function to False, the close operation isn't completed and the inspector is left open.

Syntax

Function Item_Close()


Close Event Example

This example automatically saves an item without prompting the user when the item closes.

Function Item_Close()

    If not myItem.Saved Then

        myItem.Save

    End If

End Function


CustomAction Event

Occurs when a custom action of an Outlook item executes. Both the original item and the newly created item resulting from the custom action are passed to the event. If you set the return value of this function to False, the custom action is not completed.

Syntax

Function Item_CustomAction(Action As Object, Response As Object)

Action   The custom action being executed.

Response   The new item created in response to executing the custom action.


CustomAction Event Example

This example sets a property on the response item.

Function Item_CustomAction(ByVal myAction, ByVal myResponse)

    Select Case myAction.Name

        Case "Action1"

            myResponse.Subject = "Changed by VB Script"

        Case Else

    End Select

End Function


CustomPropertyChange Event

Occurs when a custom property of an Outlook item is changed. The property name is passed to the procedure so that you can determine which custom property changed.

Syntax

Sub Item_CustomPropertyChange(Name As String)

Name   The name of the custom property that was changed.


CustomPropertyChange Event Example

This example enables a control when a Boolean field is set to True.

Sub Item_CustomPropertyChange(ByVal myPropName)

    Select Case myPropName

        Case "RespondBy"

            Set myPropChg = myItem.GetInspector.ModifiedFormPages

            Set myCtrl = myPropChg("Page 2").Controls("DateToRespond")

            If myItem.UserProperties("RespondBy").Value Then

                myCtrl.Enabled = True

                myCtrl.Backcolor = 1

            Else

                myCtrl.Enabled = False

                myCtrl.Backcolor = 0

            End If

        Case Else

    End Select

End Sub


Forward Event

Occurs when the user selects the Forward action for an Outlook item. Both the original item and the newly created item are passed to the event. If you set the return value of this function to False, the Forward action isn't completed and the new item isn't displayed.

Syntax

Function Item_Forward(Response As Object)

Response   The item created in response to the event.


Forward Event Example

This example disables forwarding on an item and displays a message that the item may not be forwarded.

Function Item_Forward(ByVal myForwardItem)

    MsgBox "You may not forward this message!"

    Item_Forward = False

End Function


Open Event

Occurs when an Outlook item is being opened in an inspector. When this event occurs, the Inspector object is initialized but not yet displayed. If you set the return value of this function to False, the open operation is not completed and the inspector isn't displayed.

Syntax

Function Item_Open()


Open Event Example

This example opens an item in its inspector and displays the "All Fields" page.

Function Item_Open()

    myItem.GetInspector.SetCurrentFormPage "All Fields"

End Function


PropertyChange Event

Occurs when a standard property (for example, Subject or To) of an Outlook item is changed. The property name is passed to the event so that you can determine which property changed.

Syntax

Sub Item_PropertyChange(Name As String)

Name   The name of the property that was changed.


PropertyChange Event Example

This example disables setting a reminder on an item.

Sub Item_PropertyChange(ByVal myPropertyName)

    Select Case myPropertyName

        Case "ReminderSet"

            MsgBox "You may not set a reminder on this item!"

            myItem.ReminderSet = False

        Case Else

    End Select

End Sub


Read Event

Occurs when an existing Outlook item is opened for editing by the user. The Read event differs from the Open event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an inspector.

Syntax

Sub Item_Read()


Read Event Example

This example increments a counter to track how often an item is read.

Sub Item_Read()

    Set myProperty = myItem.UserProperties("ReadCount").Value

    myProperty.Value = myProperty.Value + 1

    myItem.Save

End Sub


Reply Event

Occurs when the user selects the Reply action for an Outlook item. Both the original item and the newly created reply item are passed to the event. If you set the return value of this function to False, the Reply action isn't completed and the new item isn't displayed.

Syntax

Function Item_Reply(Response As Object)

Response   The item created in response to the event.


Reply Event Example

This example sets the Sent Items folder for the reply item to the folder in which the original item resides.

Function Item_Reply(ByVal myResponse)

    Set myResponse.SaveSentMessageFolder = myItem.Parent

End Function


ReplyAll Event

Occurs when the user selects the ReplyAll action for an Outlook item. Both the original item and the newly created reply item are passed to the event. If you set the return value of this function to False, the ReplyAll action isn't completed and the new item isn't displayed.

Syntax

Function Item_ReplyAll(Response As Object)

Response   The item created in response to the event.


ReplyAll Event Example

This example reminds the user that proceeding will reply to all original recipients of an item and, depending on the user's response, either allows the action to continue or stops it.

Function Item_ReplyAll(ByVal myResponse)

    myResult = MsgBox ("Do you really want to reply to all original _

        recipients?", 289, "Flame Protector")

    If myResult = 1 Then

        Item_ReplyAll = True

    Else

        Item_ReplyAll = False

    End If

End Function


Send Event

Occurs when the user selects the Send action for an Outlook item. If you set the return value of this function to False, the Send action isn't completed and the item's inspector is left open.

Syntax

Function Item_Send()


Send Event Example

This example sends an item with an automatic expiration date of one week.

Function Item_Send()

    myItem.ExpiryTime = Date + 7

End Function


Write Event

Occurs when an Outlook item is saved, either explicitly (for example, using the Save or SaveAs method) or implicitly (for example, in response to a prompt when closing the item's inspector). If you set the return value of this function to False, the save operation isn't completed.

Syntax

Function Item_Write()


Write Event Example

This example warns the user that item is about to be saved and will overwrite any existing item and, depending on the user's response, either allows the operation to continue or stops it.

Function Item_Write()

    myResult = MsgBox ("The item is about to be saved. Do you wish _

        to overwrite the existing item?", 289, "Save")

    If myResult = 1 Then

        Item_Write = True

    Else

        Item_Write = False

    End If

End Function


Assign Method Example

This example creates a simple task and delegates it as a task request to another user.

Set myItem = myOlApp.CreateItem(olTaskItem)

myItem.Assign

Set myDelegate = myItem.Recipients.Add("April LaMonte")

myItem.Subject = "Prepare Agenda For Meeting"

myItem.DueDate = #9/20/97#

myItem.Send


Close Method Example

This example opens a mail message, adds a recipient to it to introduce a change, gets the inspector for the item, then closes the inspector, prompting the user to save changes.

Set myItem = = myOlApp.CreateItem(olMailItem)

myItem.Recipients.Add "David Goodhand"

Set myInspector = myItem.GetInspector

myInspector.Close olPromptForSave


CreateItemFromTemplate Method Example

This example creates and displays a new item created from the Outlook Mail template.

Set myOlApp = CreateObject("Outlook Application")

Set myItem = myOlApp.CreateItemFromTemplate("C:\Program

    Files\Microsoft Office\Templates\Outlook\Mail.oft")

myItem.Display


HideFormPage Method Example

This example hides the Message page of the currently open item.

Set myInspector = myOlApp.ActiveInspector

myInspector.HideFormPage("Message")


IncludeRecurrences Property Example

This example demonstrate how to return a specific instance of a recurring appointment.

Set myItems = myOlApp.ActiveExplorer.CurrentFolder.Items

myItems.Sort "[Start]"

myItems.IncludeRecurrences = True

MsgBox "The fifth instance of the recurring appointment _

    occurs on:" & myItems.Item(5).Start


Logon Method Example

This example logs on to a new session, displaying the dialog box to verify the profile name and password.

Set olNameSpace = myOlApp.GetNameSpace("MAPI")

olNameSpace.Logon "myProfile", "myPassword", True, True


MeetingStatus Property Example

This example creates an appointment and sets the meeting status to "Meeting" to turn it into a meeting request with both a required and an optional attendee.

Set myItem = myOlApp.CreateItem(olAppointmentItem)

Set myItem.MeetingStatus = olMeeting

myItem.Subject = "Strategy Meeting"

myItem.Location = "Conference Room B"

myItem.Start = #9/24/97 1:30:00 PM#

myItem.Duration = 90

Set myRequiredAttendee = myItem.Recipients.Add("Nate _

    Sun")

myRequiredAttendee.Type = olRequired

Set myOptionalAttendee = myItem.Recipients.Add("Kevin _

    Kennedy")

myOptionalAttendee.Type = olOptional

Set myResourceAttendee = _

    myItem.Recipients.Add("Conference Room B")

myResourceAttendee.Type = olResource

myItem.Send


Move Method Example

This example moves all mail messages sent by Mike Nash from the default Inbox folder to the Personal Mail folder.

Set myInbox = myOlApp.GetDefaultFolder(olFolderInbox)

Set myItems = myInbox.Items

Set myDestFolder = myInbox.Folders("Personal Mail")

Set myItem = myItems.Find("[SenderName] = 'Mike Nash'")

While TypeName(myItem) <> "Nothing"

    myItem.Move myDestFolder

    Set myItem = myItems.FindNext

Wend


PublishForm Method Example

This example creates a contact, obtains its FormDescription object, and saves it in the Folder form registry of the default Contacts folder.

Set myFolder = _

    olNameSpace.GetDefaultFolder(olFolderContacts)

Set myItem = myOlApp.CreateItem(olContactItem)

Set myForm = myItem.FormDescription

myForm.Name = "My Contact"

myForm.PublishForm olFolderRegistry, myFolder

This example creates an appointment, obtains its FormDescription object, and saves it in the user's Personal form registry.

Set myItem = myOlApp.CreateItem(olAppointmentItem)

Set myForm = myItem.FormDescription

myForm.Name = "Interview Scheduler"

myForm.PublishForm olPersonalRegistry


Remove Method Example

This example removes all attachments from a forwarded message before sending it on to John Y. Chen.

Set myItem = myOlApp.ActiveInspector.CurrentItem.Forward

Set myAttachments = myItem.Attachments

While myAttachments.Count > 0

    myAttachments.Remove 1

Wend

myItem.Recipients.Add "John Y. Chen"

myItem.Send


Resolve Method Example

This example attempts to resolve a recipient and, if unsuccessful, displays the item so a user can resolve it manually.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add("Tim O'Brien")

If Not myRecipient.Resolve Then myItem.Display


ResolveAll Method Example

This example attempts to resolve all recipients and, if unsuccessful, displays a message box for each unresolved recipient.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipients = myItem.Recipients

myRecipients.Add("Aaron Con")

myRecipients.Add("Viki Parrott")

myRecipients.Add("Jeffrey Weems")

If Not myRecipients.ResolveAll Then

    For Each myRecipient In myRecipients

        If Not myRecipient.Resolved Then

            MsgBox myRecipient.Name

        End If

     Next

End If


Restrict Method Example

This example gets all Inbox items dealing with Project X and moves them to the Project X folder.

Set myFolder =  _

    olNameSpace.GetDefaultFolder(olFolderInbox)

Set my Items = myFolder.Items

Set myRestrictItems = myItems.Restrict("[Categories] = _

    'Project X'")

For Each myItem In myRestrictItems

    myItem.Move myFolder.Folders("Project X")

Next


SaveAs Method Example

This example saves the currently open item as a text file in the My Documents folder, using the subject as the file name.

Set myItem = myOlApp.ActiveInspector.CurrentItem

myItem.SaveAs "C:\My Documents\" & myItem.Subject & _

    ".txt", olTXT


SaveAsFile Method Example

This example saves the first attachment of the currently open item as a file in the My Documents folder, using the attachment's display name as the file name.

Set myItem = myOlApp.ActiveInspector.CurrentItem

Set myAttachments = myItem.Attachments

myAttachments.Item(1).SaveAsFile "C:\My Documents\" & _

    myAttachments.Item(1).DisplayName


ShowFormPage Method Example

This example shows the All Fields page of the currently open item.

Set myInspector = myOlApp.ActiveInspector

myInspector.ShowFormPage("All Fields")


StatusReport Method Example

This example reports the status of the currently open task.

Set myTask = myOlApp.ActiveInspector.CurrentItem

Set myReport = myTask.StatusReport

myReport.Send


Application Object

Represents the entire Microsoft Outlook application. This is the only object in the hierarchy that can be returned by using the CreateObject or GetObject function.

The Outlook Application object has several purposes:

•	As the root object, it allows access to other objects in the Outlook hierarchy.

•	It allows direct access to new items created by using CreateItem, without having to traverse the object hierarchy.

•	It allows access to the active interface objects (the explorer and the inspector)

Using the Application Object

When you use Automation to control Microsoft Outlook from another application, you use the CreateObject function to create an Outlook Application object. The following example starts Microsoft Outlook (if it's not already running) and opens the default Inbox folder.

Set myOlApp = CreateObject("Outlook.Application")

Set olNameSpace = myOlApp.GetNameSpace("MAPI")

Set myFolder= _

    olNameSpace.GetDefaultFolder(olFolderInbox)

myFolder.Display

The following example uses the Application object to create and open a new contact.

Set myOlApp = CreateObject("Outlook.Application")

Set myItem = myOlApp.CreateItem(olContactItem)

myItem.Display


Action Object

Represents a specialized action (for example, the voting options response) that can be executed on an item. The Action object is a member of the Actions collection.

Using the Action Object

Use Actions(index), where index is the name of an available action, to return a single Action object.The following example uses the "Reply" action of a particular item to send a reply.

Set myReply = myItem.Actions("Reply").Execute

The following example does the same thing, using a different reply style for the reply.

myItem.Actions("Reply").ReplyStyle = _

    olIncludeOriginalText

Set myReply = myItem.Actions("Reply").Execute


Actions Collection Object

A collection of Action objects that represent all the specialized actions that can be executed on an Outlook item.

Using the Actions Collection

Use the Actions property to return the Actions collection for any Outlook item object.

Use Actions(index), where index is the name of an available action, to return a single Action object.The following example uses the "Reply" action of a particular item to send a reply.

Set myReply = myItem.Actions("Reply").Execute


AppointmentItem Object

Represents an appointment in the Calendar folder. An AppointmentItem object can represent a meeting, a one-time appointment, or a recurring appointment or meeting.

Using the AppointmentItem Object

Use the CreateItem method to create an AppointmentItem object that represents a new appointment. The following example returns a new appointment.

Set myItem = myOlApp.CreateItem(olAppointmentItem)

Use Items(index), where index is the index number of an appointment or a value used to match the default property of an appointment, to return a single AppointmentItem object from a Calendar folder.

You can also return an AppointmentItem object from a MeetingRequestItem object by using the GetAssociatedAppointment method.


Attachment Object

Represents a document or link to a document contained in an Outlook item.

Using the Attachment Object

Use Attachments(index), where index is the index number, to return a single Attachment object.

Use the Add method to add an attachment to an item. The following example creates a new mail message, attaches a Q496.xls as an attachment (not a link), and gives the attachment a descriptive caption.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAttachments = myItem.Attachments

myAttachments.Add "C:\My Documents\Q496.xls", _

    olByValue, 1, "4th Quarter 1996 Results Chart"


Attachments Collection Object

A collection of Attachment objects that represent the attachments in an Outlook item.

Using the Attachments Collection

Use the Attachments property to return the Attachments collection for any Outlook item (except notes).

Use the Add method to add an attachment to an item. The following example creates a new mail message, attaches a Q496.xls as an attachment (not a link), and gives the attachment a descriptive caption.

Set myItem = myOlApp.CreateItem(olMailItem)

Set myAttachments = myItem.Attachments

myAttachments.Add "C:\My Documents\Q496.xls", _

    olByValue, 1, "4th Quarter 1996 Results Chart"

Use Attachments(index), where index is the index number, to return a single Attachment object.


ContactItem Object

Represents a contact in a Contacts folder. A contact can represent any person with whom you have any personal or professional contact.

Using the ContactItem Object

Use the CreateItem method to create a ContactItem object that represents a new contact. The following example returns a new contact.

Set myItem = myOlApp.CreateItem(olContactItem)

Use Items(index), where index is the index number of a contact or a value used to match the default property of a contact, to return a single ContactItem object from a Contacts folder.


Explorer Object

Represents the window in which the contents of a folder are displayed.

Using the Explorer Object

Use the ActiveExplorer method to return the currently active explorer (if there is one).

Use the GetExplorer method to return the Explorer object associated with a folder.

Use the Display method to display a folder in its associated explorer.


Folders Collection Object

A collection of MAPIFolder objects that represent all the available Outlook folders.

Using the Folders Collection

Use the Folders property to return the Folders collection from a NameSpace object or another MAPIFolder object.

Use Folders(index), where index is the name or index number, to return a single MAPIFolder object. Folder names are case-sensitive. The following example returns the folder named "Inbox" from myFolder

Set myNewFolder = myFolder.Folders("Inbox")

The following example returns the first folder in myFolder.

Set myNewFolder = myFolder.Folders(1)


Inspector Object

Represents the window in which an Outlook item is displayed.

Using the Inspector Object

Use the ActiveInspector method to return the currently active Inspector (if there is one).

Use the GetInspector method to return the Inspector object associated with an item.

Use the Display method to display an item in its associated inspector.


Items Collection Object

A collection of Outlook item objects in a folder. Outlook item objects include the AppoinmentItem, ContactItem, JournalItem, MailItem, MeetingRequestItem, NoteItem, PostItem, RemoteItem, ReportItem, TaskItem, and TaskRequestItem objects.

Using the Items Collection

Use the Items property to return the Items collection of a MAPIFolder object.

Use Items(index), where index is the name or index number, to return a single Outlook item. The following example returns the first item with the subject "Need your advice" in myFolder.

Set myItem = myFolder.Items("Need your advice")

The following example returns the first item in myFolder.

Set myItem = myFolder.Items(1)


JournalItem Object

Represents a journal entry in a Journal folder. A journal entry represents a record of all Outlook-moderated transactions for any given period.

Using the JournalItem Object

Use the CreateItem method to create a JournalItem object that represents a new journal entry. The following example returns a new journal entry.

Set myItem = myOlApp.CreateItem(olJournalItem)

Use Items(index), where index is the index number of a journal entry or a value used to match the default property of a journal entry, to return a single JournalItem object from a Journal folder.


MailItem Object

Represents a mail message in an Inbox (mail) folder.

Using the MailItem Object

Use the CreateItem method to create a MailItem object that represents a new mail message. The following example returns a new mail message.

Set myItem = myOlApp.CreateItem(olMailItem)

Use Items(index), where index is the index number of a mail message or a value used to match the default property of a message, to return a single MailItem object from an Inbox folder.


MAPIFolder Object

Represents an Outlook folder. A MAPIFolder object can contain other MAPIFolder objects, as well as Outlook items. You can navigate nested folders by using a combination of Folders(index), which returns a folder within a name space or another folder, and the Parent property, which returns the containing object.

Using the MAPIFolder Object

Use Folders(index), where index is the name or index number, to return a single MAPIFolder object from a NameSpace object or another MAPIFolder object.

There is a set of folders within an Outlook data store that support the default functionality of Outlook. Use GetDefaultFolders(index), where index is one of the OlDefaultFolders constants (olFolderCalendar, olFolderContacts, olFolderDeletedItems, olFolderInbox, olFolderJournal, olFolderNotes, olFolderOutbox, olFolderSentMail, olFolderTasks), to return one of the default Outlook folders in the Outlook NameSpace object.

Use the Add method to add a folder to the Folders collection. The Add method has an optional argument that can be used to specify the type of items that can be stored in that folder. By default, folders created inside another folder inherit the type of the parent folder.

Remarks

Folders within the Outlook data store can be typed; for example, the Calendar folder will only contain AppointmentItem objects and the Contacts folder will only contain ContactItem objects.

Note that when items of a specific type are saved, they are saved directly into their corresponding default folder. For example, when the GetAssociatedAppointment method is applied to a MeetingRequestItem in the Inbox folder, the appointment that is returned will be saved to the default Calendar folder.


MeetingRequestItem Object

Represents an item in an Inbox (mail) folder. A MeetingRequestItem object represents a change to the recipient's Calendar folder initiated by another party or as a result of a group action.

Using the MeetingRequestItem Object

Unlike other Outlook objects, you cannot create this object or find an existing one in the Items collection. It is created automatically when you set the MeetingStatus property of an AppointmentItem object to olMeeting and sending it to one or more users. The following example creates an appointment and turns it into a meeting request with both a required and an optional attendee.

Set myItem = myOlApp.CreateItem(olAppointmentItem)

myItem.MeetingStatus = olMeeting

myItem.Subject = "Strategy Meeting"

myItem.Location = "Conference Room B"

myItem.Start = #9/24/97 1:30:00 PM#

myItem.Duration = 90

Set myRequiredAttendee = myItem.Recipients.Add("Nate _

    Sun")

myRequiredAttendee.Type = olRequired

Set myOptionalAttendee = myItem.Recipients.Add("Kevin _

    Kennedy")

myOptionalAttendee.Type = olOptional

Set myResourceAttendee = _

    myItem.Recipients.Add("Conference Room B")

myResourceAttendee.Type = olResource

myItem.Send

Use the GetAssociatedAppointment method to return the AppointmentItem object associated with a MeetingRequestItem object, and work directly with the AppointmentItem object to respond to the request.


NameSpace Object

Represents an abstract root object for any data source. The object itself provides methods for logging in and out, accessing storage objects directly by ID, accessing certain special default folders directly, and accessing data sources owned by other users.

Using the NameSpace Object

Use GetNameSpace("MAPI") to return the Outlook NameSpace object from the Application object.

Remarks

The only data source supported is "MAPI", which allows access to all Outlook data stored in MAPI.


NoteItem Object

Represents a note (an annotation attached to a document) in a Notes folder.

Using the NoteItem Object

Use the CreateItem method to create a NoteItem object that represents a new note. The following example returns a new note.

Set myItem = myOlApp.CreateItem(olNoteItem)

Use Items(index), where index is the index number of a note or a value used to match the default property of a note, to return a single NoteItem object from an Notes folder.


Pages Collection Object

A collection of pages that represent the pages of an inspector. Every Inspector object has a Pages collection defined, which is empty (count 0) if the Outlook item has never been customized before.

Using the Pages Collection

Use the ModifiedFormPages property to return the Pages collection from an Inspector object. The following example returns the Pages collection for the active inspector.

Set myPages = myItem.GetInspector.ModifiedFormPages

Use the Add method to create a custom page (you can add as many as 5 customizable pages). Use the Name argument of the Add method to set the display name of the returned page. In addition to adding custom pages, you can use the Name argument to return the main page of an Inspector object for modification.

The following example returns a custom page with a default name (such as "Custom1").

Set myPage = myPages.Add

The following example returns a custom page named "My Page."

Set myPage = myPages.Add("My Page")

The following example returns the Message page if the inspector contains a mail message.

Set myPage = myPages.Add("Message")

The following example returns the General (main) page if the inspector contains a contact.

Set myPage = myPages.Add("General")

Use ModifiedFormPages(index), where index is the name or index numbe, to return a single page from a Pages collection.


Recipient Object

Represents a user or resource in Outlook, generally a mail message addressee.

Using the Recipient Object

Use Recipients(index), where index is the name or index number, to return a single Recipient object.

Use the Add method to create a new Recipient object and add it to the Recipients collection. The Type property of a new Recipient object is set to the default for the associated AppointmentItem, JournalItem, MailItem or TaskItem object and must be reset to indicate another recipient type.

The following example creates a new MailItem object and adds "Jon Grande" as the recipient using the default type ("To").

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add "Jon Grande"

The following example creates the same MailItem object as the preceding example, and then changes the type of the Recipient object from the default ("To") to "CC."

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add "Jon Grande"

Set myRecipient.Type = olCC


Recipients Collection Object

The Recipients collection is a standard collection of Recipient objects.

Using the Recipients Collection

Use the Recipients property to return the Recipients collection of an AppointmentItem, JournalItem, MailItem, orTaskItem object.

Use the Add method to create a new Recipient object and add it to the Recipients collection. The Type property of a new Recipient object is set to the default for the associated AppointmentItem, JournalItem, MailItem or TaskItem object and must be reset to indicate another recipient type.

The following example creates a new MailItem object and adds "Jon Grande" as the recipient using the default type ("To").

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add "Jon Grande"

The following example creates the same MailItem object as the preceding example, and then changes the type of the Recipient object from the default ("To") to "CC."

Set myItem = myOlApp.CreateItem(olMailItem)

Set myRecipient = myItem.Recipients.Add "Jon Grande"

Set myRecipient.Type = olCC

Use Recipients(index), where index is the name or index number, to return a single Recipient object.


RecurrencePattern Object

Represents the pattern of incidence of recurring appointments and tasks for the associated AppointmentItem and TaskItem object.

Using the RecurrencePattern Object

Use the GetRecurrencePattern method to return the RecurrencePattern object associated with an AppointmentItem or TaskItem object.

Remarks

Calling GetRecurrencePattern or ClearRecurrencePattern has the side effect of setting the IsRecurring property of the item accordingly. This property can be used as required for efficient filtering of Items collections.

The type of recurrence pattern is indicated by the RecurrenceType property. The RecurrenceType property is the first property you should set.

The following properties are valid for all recurrence patterns: EndDate, Occurrences, StartDate, StartTime, or Type.

The following table shows the properties that are valid for the different recurrence types. The properties listed are not all required for the given type; an error occurs if the item is saved and the property is null or contains an invalid value. Monthly and yearly patterns are only valid for a single day. Weekly patterns are only valid as the Or of the DayOfWeekMask.

RecurrenceType	Properties	Example
olRecursDaily (one or the other property is required, not both)	Interval	Every N days
	DayOfWeekMask	Every Tuesday, Wednesday, and Thursday
olRecursMonthly	Interval	Every N months
	DayOfMonth	The Nth day of the month
olRecursMonthlyNth	Interval	Every N months
	Instance	The Nth Tuesday
	DayOfWeekMask	Every Tuesday and Wednesday
olRecursWeekly	Interval	Every N weeks
	DayOfWeekMask	Every Tuesday, Wednesday, and Thursday
olRecursYearly	DayOfMonth	The Nth day of the month
	MonthOfYear	February
olRecursYearlyNth	Instance	The Nth Tuesday
	DayOfWeekMask	Tuesday, Wednesday, Thursday
	MonthOfYear	February


TaskItem Object

Represents a task (an assigned, delegated, or self-imposed task to be performed within a specified time frame) in a Tasks folder.

Using The TaskItem Object

Use the CreateItem method to create a TaskItem object that represents a new task. The following example returns a new task.

Set myItem = myOlApp.CreateItem(olTaskItem)

Use Items(index), where index is the index number of a task or a value used to match the default property of a task, to return a single TaskItem object from an Tasks folder.


TaskRequestItem Object

Represents an item in an Inbox (mail) folder. A TaskRequestItem object represents a change to the recipient's Tasks list initiated by another party or as a result of a group tasking.

Using the TaskRequestItem Object

Unlike other Outlook objects, you cannot create this object or find an existing one in the Items collection. It is created automatically when you apply the Assign method to a TaskItem object to assign (delegate) the associated task to another user. The following example creates a simple task and assigns it as a task request to another user.

Set myItem = myOlApp.CreateItem(olTaskItem)

myItem.Assign

Set myDelegate = myItem.Recipients.Add("April LaMonte")

myItem.Subject = "Prepare Agenda For Meeting"

myItem.DueDate = #9/20/97#

myItem.Send

Use the GetAssociatedTask method to return the TaskRequestItem object, and work directly with the TaskItem object to respond to the request.


UserProperties Collection Object

A collection of UserProperty objects that represent the custom properties of an Outlook item.

Using The UserProperties Object

Use the UserProperties property to return the UserProperties collection for an Outlook items.

Use the Add method to create new UserProperty for an item and adding it to the UserProperties collection. The Add method allows you to specify a name and type for the new property. The following example adds a custom text property named "MyPropName" to myItem.

Set myProp = myItem.UserProperties.Add("MyPropName", olText)

Use UserProperties(index), where index is a name or index number, to return a single UserProperty object.

Remarks

When you create a custom property, a field is added in the folder that contains the item (using the same name as the property). That field can be used as a column in folder views.


UserProperty Object

Represents a custom property of an Outlook item.

Using The UserProperty Object

Use UserProperties(index), where index is a name or index number, to return a single UserProperty object.

Use the Add method to create new UserProperty for an item and adding it to the UserProperties collection. The Add method allows you to specify a name and type for the new property. The following example adds a custom text property named "MyPropName" to myItem.

Set myProp = myItem.UserProperties.Add("MyPropName", olText)

Remarks

When you create a custom property, a field is added in the folder that contains the item (using the same name as the property). That field can be used as a column in folder views.


Outlook Visual Basic Help has been installed

The Visual Basic Help file for Microsoft Outlook has already been installed. You do not need to install it from the ValuPack.