SafeItem object

 

SafeItem is the ancestor of all other Safe*Item objects (such as SafeMailItem) and exposes properties and methods common to all Safe*Item objects.

 

Properties

Methods

 


Derived from: SafeItem


Properties

 
Attachments

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

 

Unlike Attachments collection in the Outlook Object Model, blocked (unsafe) attachments are not excluded from the collection.

 

 
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.
 
Body

Returns a String representing the clear-text body of the message. Read-only.

Note: Since Outlook only blocks reading of this property, Redemption only implements the read accessor. To set this property, use the original Outlook Item assigned to the Item property or use late binding.

 

 
Fields[PropTag]

Returns or sets an Extended MAPI property

PropTag -  integer Extended MAPI property tag (e.g. 0x0037001E for PR_SUBJECT_A)

Note that RDO family of objects also supports accessing MAPI properties by a DASL property name.

 

You can use one of the MAPITags enumeration elements, e.g. MAPITags.PR_SUBJECT.

Scalar properties are returned as variants of the corresponding type (e.g. PT_STRING8 and PT_UNICODE properties are returned as strings, PT_LONG as integers, etc).

For the object properties (PT_OBJECT, such as PR_CONTAINER_CONTENTS, PR_ACL_TABLE, etc) Redemption tries to open them as IMAPITable Extended MAPI object and, if successful, returns an instance of the Redemption.MAPITable object

 

 
Item Object (IDispatch), read/write.
This property must be set to an Outlook (or CDO 1.21) object before the Safe*Item object can be used. E.g. for the SafeAppointmentItem, set the Item property to an instance of an Outook.AppointmentItem object.
 
Recipients

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

 

 
RTFBody

Returns or sets a String representing the RTF body of the specified item. The RTFBody property should be an RTF syntax string. Read/write.

 

 
Sender

Returns an AddressEntry object representing the message sender.

Read-only.

 

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

Methods


Commit

The method commits all pending changes that only exist in the Outlook internal cache without actually saving the item. Previously, an Outlook object must have been saved (by calling the Save method) to make pending changes made through the Outlook Object Model or Outlook UI visible to Extended MAPI and Redemption. Calling Save can be undesirable as it persists the item and makes it visible to the end user (e.g. in the Drafts folder), which can requires the saved item to be tracked and deleted. Moreover, after calling Save Outlook would no longer prompt the user to save the pending changes.

Commit method preserves the unsaved state of the item while making all the latest changes visible to Redemption without actually saving it. If the item has no pending changes, Commit does nothing.

RDOSession.GetRDOObjectFromOutlookObject also silently commits the changes at the time of the call before returning an RDO object corresponding to the Outlook object passed as the parameter.

 

'create new message, modify it without saving

set newMailItem = Application.CreateItem(0)

newMailItem.Recipients.Add("test@dimastr.com")

'access the newly created unsaved item using Redemption

set sItem = CreateObject("Redemption.SafeMailItem")

sItem.Item = newMailItem

'Redemption will not see the new recipient added above

MsgBox "# of recipients before Commit:" & vbCrLf & sItem.Recipients.Count

'after calling Commit, Redemption can see pending changes

'without saving the item

sItem.Commit

MsgBox "# of recipients after Commit:" & vbCrLf & sItem.Recipients.Count

CopyTo(DestObj)

Copies the object to the target object.

 

 

 
GetIDsFromNames(GUID, ID)

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.

 

 

Import(Path, Type)

 

Imports the contents of an external file into the message.

Path - string. Fully qualified path to the file to be imported.

Type - optional. One of rdoSaveAsType enum values. If the type is not specified, the MSG format (MSG) is used.

 

 
MarkSaved
The method tricks the original OOM object assigned to the Item property into assuming that there are no pending changes to be saved. Closing the Outlook item after calling MarkSaved will not display the save prompt.

private void Inspector_Close()

{

    SafeMailItem smi = new SafeMailItem();

    smi.Item = _inspector.CurrentItem;

    //discard pending changes to let

    //the inspector close without a prompt

}

 

SaveAs(Path, Type)

Saves the message to the specified path and in the format of the specified file type.

Path - string. Fully qualified path.

Type - optional. One of rdoSaveAsType enum values. If the file type is not specified, the MSG format (.msg) is used.

Supported formats:

olMSG (3)

olMsgUnicode (9)

olRTF (1)

olTemplate (2)

olTxt (0)

olVCard (6)

olRFC822 (1024)

olRFC822_Redemption (1031)

olRFC822_Outlook (1030)

olTNEF (1025)

olHTML (5)

olRTFNoHeaders (1026)

olMHTML (1027)

olVCal (7)

olICal (8)

 

 
Send Sends the message