MAPIUtils object

 

This object is obsolete. Use RDOSession object instead.

 

MAPIUtils implements miscellaneous utility methods.

 

The example retrieves the sender address of the item currently selected in Outlook.

set utils = CreateObject("Redemption.MAPIUtils")
set oItem = Application.ActiveExplorer.Selection(1)
PR_SENDER_EMAIL_ADDRESS_W = &H0C1F001F
v = utils.HrGetOneProp(oItem, PR_SENDER_EMAIL_ADDRESS_W)
msgbox v

 

Properties

Methods

 


Derived from: IDispatch


Properties


AddressBookFilter

String, read/write.

When you set this property, Address Book shown with a call to MAPIUtils.AddressBook will only display the address book container(s) whose name matches the AddressBookFilter. E.g. if you set AddressBookFilter to "Customers", AddressBook() method will only display subcontainers named "Customers".

  

AuthKey

String, write-only.
Assign any string value to it - once assigned, the value is securely stored and all subsequent calls to the Redemption objects must set this property to the same value before accessing any other properties or methods.
See Security for more information.

 

CurrentProfileName

String, read-only. Returns the name of the current profile used by the MAPIUtils object.
 

DefaultABListEntryID

String, read/write. Returns or sets the entry if of the address list to be displayed first and used when resolving a name in the address book.
 

MAPIOBJECT

IMAPISession, read/write.
You can set its MAPIOBJECT property to Namespace.MAPIOBJECT from the Outlook Object Model.
 

Version

String, Read-only. Returns Redemption library version, e.g. "5.2.0.2486"
 


Methods


AddressBook

(Recipients, Title, OneAddress, ForceResolution, RecipLists, ToLabel, CcLabel, BccLabel, ParentWindow)

Displays address book. Returns Recipients collection.

  

Recipients - object, optional. Recipients object (e.g. MailItem.Recipients) to display in the Address book dialog

Title - string, optional. Title of the address book dialog

OneAddress - boolean, optional. Allow only one address to be selected

ForceResolution - boolean, optional. Force all returned recipients to be resolved.

RecipLists - integer, optional. Number of wells in the address book dialog (3 by default - To, CC, BCC).

ToLabel - string, optional. "To" label

CcLabel - string, optional. "CC" label

BccLabel - string, optional. "BCC" label

ParentWindow - integer, optional. Handle to the parent window. If none is specified, foreground window will be used as a parent

 

CompareIDs(ID1, ID2)

Compares if two items are the same. Returns true if the items are the same.

ID1 - entry id of the first item

ID2 - entry id of the second item

 

CreateRecipient

(Name, ShowDialog, ParentWnd)

Returns Recipient object which can be used in, for example, calls to SafeDistList.AddMember, or if you just want to resolve a recipient's name without creating a temporary message first.

Name - string.

ShowDialog - boolean, optional (default = false)

ParentWnd - integer, optional (default = 0)

 

GetAddressEntryFromID(ID)

Returns AddressEntry object corresponding to the specified entry id.

 

GetIDsFromNames
(MAPIProp, GUID, ID, bCreate)

Returns an id suitable for use in the Fields() collection given the GUID (as string) and ID (can be either integer or a string).

For the discussion of the named properties, see the Extended
MAPI properties
section, especially the section on named properties.

MAPIProp - object. Outlook item (MailItem, ContactItem, etc) or its MAPIOBJECT property.

GUID - string. String representation of the GUID.

ID - variant (integer or string- variant (integer or string). Named property ID. Can either be a string or an integer.

bCreate - boolean. If set to true and the property with the above parameters has never been created by Outlook, it will be created. If false, the function returns a valid property tag only if it has been already created


GetItemFromID

(EntryIDItem, EntryIDStore)

Returns MessageItem object corresponding to the specified entry id.

 

EntryIDItem - string. Entry Id of the message to open.

EntryIDStore - string, optional. Optional Entry Id of a store (StoreID) where the item to open resides.

 

GetItemFromIDEx

(EntryIDItem, EntryIDStore, Flags)

Returns MessageItem object corresponding to the specified entry id.

 

EntryIDItem - string. Entry Id of the message to open.

EntryIDStore - string, optional. Optional Entry Id of a store (StoreID) where the item to open resides.

Flags - integer, optional. Flags to be used when opening the message, e.g. MAPI_MODIFY (0x1) to specify that the write access must be granted, MAPI_NO_CACHE (0x200) to bypass the cache (Outlook 2003), etc. By default, MAPI_BEST_ACCESS (0x10) is used.

 

GetItemFromMsgFile(FielName, Createnew)

Returns MessageItem object corresponding to the specified MSG file.

FileName - string. The name of the MSG file.

CreateNew - boolean. If true a new MSG file will be created or overwritten.

 

GetNamesFromIDs

(MAPIProp, Proptag)

Given a prop tag (>=0x80000000), returns the GUID and id of the named property. This is the reverse of the GetIDsFromNames method.

Returns a NamedProperty object which exposes two properties: GUID (string) and ID (either an integer or a string)

MAPIProp - Outlook item (MailItem, MAPIFolder, etc.). or its MAPIOBJECT property.

PropTag - integer, the named property tag (>=0x80000000).

HrArrayToString

(InputArray)

Converts a variant array to its hex representation (string).

 

HrGetOneProp
(MAPIProp, propTag)

Returns the value of an Extended MAPI property

MAPIProp - object

Outlook item (MailItem, ContactItem, etc) or its MAPIOBJECT property (MailItem.MAPIOBJECT, etc)
Note that you can access the same properties if you use Safe*Item.Fields collection

PropTag - Integer property tag.

 

HrGetPropList

(Obj, bUseUnicode)

Returns a collection of property tags exposed by an Outlook or Redemption object passed as a parameter. The returned collection (PropList) has two properties: Count and Item(Index)

Obj - object. Any Outlook (MailItem, MAPIFolder, etc) or Redemption (Safe*Item, etc) object

 

bUseUnicode - boolean. optional. Force string prop tags to be returned in Unicode rather than ANSI.

 

set Utils = CreateObject("Redemption.MAPIUtils")
set PropList = Utils.HrGetPropList(MailItem)
for i = 1 to PropList.Count
    Debug.Print(Hex(PropList(i)))
Next

HrGMTToLocal(Value)

Converts the specified DateTime value from UTC to the local time zone.

Value - dateTime.

 

HrLocalToGMT(Value)

Converts the specified DateTime value from the local time zone to UTC.

Value - dateTime.

HrSetOneProp
(MAPIProp, PropTag, Value, bSave)

Sets an Extended MAPI property.

MAPIProp - object. Outlook item (MailItem, ContactItem, etc) or its MAPIOBJECT property

PropTag - Integer property tag.

Value - Variant. The value of the property. Make sure that you pass the value of correct type: if you set a string property, pass a string, passing an integer returns an error

bSave - boolean, optional. When set to true, Redemption will call IMAPIProp::SaveChanges(). Otherwise you will need to call Save on the item yourself. Be advised that Outlook keeps its own cache of changes and if Outlook thinks that no changes have been made, calling Save on an Item will not do anything.

 

HrStringToArray(InputString)

Converts a string of hex characters to a variant array.

 

ScCreateConversationIndex

(ParentConversationIndex)

Create a child conversation index from a parent conversation index in the message thread.

 

Cleanup

Redemption needs to keep reference to the IMAPISession Extended MAPI interface. Outlook 2002 might have a problem properly closing if there is an outstanding reference. Calling this method ensures that Redemption cleans up its internal references to all Extended MAPI objects.

DeliverNow

(Flags, ParentWndHandle)

Forces the delivery of incoming and/or outgoing messages.

 

Flags (optional). Flags: any combination of the following flags: fqUpload (1), fqDownload (2), fqUploadDownload (3), fqShowProgress (4), fqAsync (8). If Flags is 0 or missing, the following flags are used: fqUpload+fqDownload+fqShowProgress (7)

ParentWndHandle (optional). Parent window handle if Flags includes fqShowProgress flag.