|
RDOStore object represents a generic
message store. Depending on the actual kind of the store (see StoreKind property
below), the following methods will return store objects with extra properties
and methods. E.g. RDOPstStore implements all the properties and methods of the
RDOStore object plus implements an extra property specific to a PST store -
PstPath.
See
RDOPstStore,
RDOStore2,
RDOExchangeStore, RDOExchangeMailboxStore,
RDOExchangePublicFoldersStore,
RDOEASStore objects below.
Returned by:
RDOStores:
Item, AddPSTStore, AddDelegateExchangeMailBoxStore,
FindExchangePublicFoldersStore, GetSharedMailbox, GetStoreFromID
RDOSession.GetStoreFromID
RDOFolder.Store
RDOMail.Store
RDOIMAPAccount.Store
RDOHTTPAccount.Store
The example below logs to the default
MAPI session and prints out the file names of the PST stores and Server
Distinguished Name for the Exchange stores
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
for each Store in Session.Stores
if (Store.StoreKind = skPstAnsi) or (Store.StoreKind = skPstUnicode) Then
Debug.Print Store.Name & " - " & Store.PstPath
ElseIf (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) or (Store.StoreKind = skPublicFolders) Then
Debug.Print Store.Name & " - " & Store.ServerDN
End If
next |
Properties
Methods
Events
|
|
|
_MAPIProp methods and
properties:
GetIDsFromNames, Fields(), GetPropList, GetNamesFromIDs, CopyTo, Save,
MAPIOBJECT, Session |
|
Properties |
|
StoreKind |
Returns an enumeration
representing the message store kind
StoreKind - TxStoreKind:
skUnknown = 0;
skPstAnsi = 1;
skPstUnicode = 2;
skPrimaryExchangeMailbox = 3;
skDelegateExchangeMailbox = 4;
skPublicFolders = 5 skBCM = 6
skIMAP4 = 7 skHotmail = 8
skEAS = 9 |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
NumPstStores = 0
for each Store in Session.Stores
if (Store.StoreKind = skPstAnsi) or (Store.StoreKind = skPstUnicode) Then
NumPstStores = NumPstStores + 1
next
MsgBox "You have " &
NumPstStores & " PST stores in the profile" |
Default |
boolean, read-write. Returns
true if the store is default in the given profile. Set to true to make
the store default |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
Set Store = Session.Stores("Test PST Folders")
Store.Default = true |
RootFolder |
Returns
RDOFolder object representing the root
folder of the message store. Note that this folder is not visible to a
user |
|
IPMRootFolder |
Returns
RDOFolder object representing the top
visible folder of the message store. |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
Set Store = Session.Stores("Personal Folders")
set RootFolder = Store.IPMRootFolder
Debug.Print "Top Level folders in " & Store.Name & ":"
for each Folder in RootFolder.Folders
Debug.Print Folder.Name
next |
SearchRootFolder |
Returns
RDOFolder object representing the top search
folder of the message store. |
|
EntryID |
string, read-only. Returns
the entry id of the store |
|
Name |
string, read-write.
Reads/sets the name of the store. |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.DefaultStore
MsgBox Store.Name |
Reminders |
Returns
RDOReminders object representing the reminders collection for a
given store. |
'snooze all active
reminders for 2 minutes
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.DefaultStore
set Reminders = Store.Reminders
for each Reminder in Reminders
if Reminder.IsVisible Then
Reminder.Snooze(2) 'snooze for 2 minutes
End If
next |
StoreAccount |
returns
RDOAccount object corresponding to the
Outlook account associated with the store. Read-only.
Outlook 2002 and up only. |
set Session =
CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
for each Store in Session.Stores
set Account = Store.StoreAccount
if not (Account Is Nothing) Then
Debug.Print "Store """ & Store.Name & """ is associated to
account """ & Account.Name & """. (type """ & Account.AccountTypeStr &
""")"
End If
next |
|
Methods |
|
GetDefaultFolder(FolderType) |
FolderType - integer.
The type of default folder to return. Accepts the same values as
Namespace.GetDefaultFolder method in Outlook Object Model
(olFolderInbox, olFolderContacts, etc).
Returns
RDOFolder object.
Note that unlike RDOSession.GetDefaultFolder or
RDOStores.GetDefaultFolder , which return default folders from the default
store, this method returns the default folder from a given store, which
does not have to be the default store.
E.g. if you open a delegate Exchange mailbox, this method will return
the default folder of the mailbox owner. This also applies to multiple
PST stores, if they have the default folder structure set up.
|
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.DefaultStore.GetDefaultFolder(olFolderInbox)
for each Msg in Inbox.Items
Debug.Print(Msg.Subject)
next |
AbortSubmit(MessageEntryID) |
Aborts message submission for
a given message.
MessageEntryID -
string. The entry id of a message marked for submission. |
|
CompareEntryIDs(EntryID1,
EntryID2) |
Checks whether the two entry
ids refer to the same MAPI object. Note that entry ids cannot be
directly compared and multiple entry ids can refer to the same object
(e.g. in case of long term vs. short term entry id).
EntryID1 - string, entry id
of the first object
EntryID2 - string, entry id
of the second object |
|
GetMessageFromID(EntryIDMessage,
Flags) |
EntryIDMessage -
string representing the entry id of the message
Flags - (optional). integer flags to be used to call
IMAPISession::OpenEntry. By default MAPI_BEST_ACCESS (0x10) is used.
This parameter is most useful if you need to bypass the cached mode in
Outlook 2003. E.g. passing MAPI_NO_CACHE (0x200) +
MAPI_BEST_ACCESS (0x10) will open the message in the best access mode
bypassing the cached store.
Returns RDOMail object.
|
|
GetFolderFromID(EntryIDFolder,
Flags) |
EntryIDFolder - string
representing the entry id of the folder
Flags - (optional). integer flags to be used to call
IMAPISession::OpenEntry. By default MAPI_BEST_ACCESS (0x10) is used.
This parameter is most useful if you need to bypass the cached mode in
Outlook 2003. E.g. passing MAPI_NO_CACHE (0x200) +
MAPI_BEST_ACCESS (0x10) will open the folder in the best access mode
bypassing the cached store.
Returns RDOFolder object.
|
|
Remove |
Removes the given store from
the profile. |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
Set Store = Session.Stores("Test PST Folders")
Store.Remove |
|
Events: |
|
OnNewMail(EntryID) |
Fires when a new message is
delivered to the Inbox of the store.
EntryID - string,
entry id (in hex) of the newly delivered message. Note that under
Exchange, the entry id is a short term entry id. To retrieve the long
term entry id, open the message (e.g. using
RDOSession.GetMessageFromID), then read the EntryID property from the
RDOMail
object. |
Dim WithEvents Store As
Redemption.RDOStore
...
Set Session = New
Redemption.RDOSession
Session.Logon
Set Store =
Session.Stores.DefaultStore
...
Sub Store_OnNewMail(ByVal
EntryID As String)
Dim Msg As Redemption.RDOMail
Set Msg = Store.GetMessageFromID(EntryID)
MsgBox "Store_OnNewMail: " & Msg.Subject
End Sub
|
OnMessageCreated(EntryID) |
Fires when a message is
created in the store.
EntryID - string,
entry id (in hex) of the message.
|
|
OnMessageCreatedEx(EntryID,
ParentEntryID)
|
Fires when a message is
created in the store.
EntryID - string,
entry id (in hex) of the message.
ParentID - entry id of the parent folder
|
|
OnFolderCreated(EntryID) |
Fires when a folder is
created in the store.
EntryID - string,
entry id (in hex) of the folder.
|
|
OnMessageCopied(EntryID) |
Fires when a message is
copied in the store.
EntryID - string,
entry id (in hex) of the message.
|
|
OnFolderCopied(EntryID) |
Fires when a folder is copied
in the store.
EntryID - string,
entry id (in hex) of the folder.
|
|
OnMessageDeleted(EntryID) |
Fires when a message is
deleted in the store.
EntryID - string,
entry id (in hex) of the message.
|
|
OnMessageDeletedEx(EntryID,
ParentEntryID)
|
Fires when a message is
deleted in the store.
EntryID - string,
entry id (in hex) of the message.
ParentID - entry id of the parent folder
|
|
OnFolderDeleted(EntryID) |
Fires when a folder is
deleted in the store.
EntryID - string,
entry id (in hex) of the folder.
|
|
OnMessageModified(EntryID) |
Fires when a message is
modified in the store.
EntryID - string,
entry id (in hex) of the message.
|
Dim WithEvents Store As
Redemption.RDOStore
...
Set Session = New
Redemption.RDOSession
Session.Logon
Set Store =
Session.Stores.DefaultStore
...
Sub
Store_OnMessageModified(ByVal EntryID As String)
Dim Msg As Redemption.RDOMail
Set Msg = Store.GetMessageFromID(EntryID)
MsgBox "Store_OnMessageModified: " & Msg.Subject
End Sub
|
OnMessageModifiedEx(EntryID,
ParentEntryID) |
Fires when a message is
modified in the store.
EntryID - string,
entry id (in hex) of the message.
ParentID - entry id of the parent folder
|
|
OnFolderModified(EntryID) |
Fires when a folder is
modified in the store.
EntryID - string,
entry id (in hex) of the folder.
|
|
OnMessageMoved(EntryID) |
Fires when a message is moved
in the store.
EntryID - string,
entry id (in hex) of the message.
|
|
OnMessageMovedEx(EntryID,
OldParentEntryID, NewParentEntryID) |
Fires when a message is moved
in the store.
EntryID - string,
entry id (in hex) of the message.
OldParentEntryID - string, entry id (in hex) of the old parent
folder.
NewParentEntryID - string, entry id (in hex) of the new parent
folder.
|
Dim WithEvents Store As
Redemption.RDOStore
...
Set Session = New
Redemption.RDOSession
Session.Logon
Set Store =
Session.Stores.DefaultStore
...
Sub Store_OnMessageMovedEx(ByVal EntryID As String, ByVal
OldParentEntryID As String, ByVal NewParentEntryID As String)
Dim Msg As Redemption.RDOMail
Dim OldParent As Redemption.RDOFolder
Dim NewParent As Redemption.RDOFolder
Set Msg = Store.GetMessageFromID(EntryID)
Set OldParent = Store.GetFolderFromID(OldParentEntryID)
Set NewParent = Store.GetFolderFromID(NewParentEntryID)
MsgBox "Store_OnMessageModifiedEx: " & Msg.Subject & _
"; Old parent: " & OldParent.Name & _
"; New parent: " & NewParent.Name
End Sub
|
OnMessageMoved3(EntryID,
OldParentEntryID, NewParentEntryID, OldEntryID) |
Fires when a message is moved
in the store.
EntryID - string,
entry id (in hex) of the message.
OldParentEntryID - string, entry id (in hex) of the old parent
folder.
NewParentEntryID - string, entry id (in hex) of the new parent
folder.
OldEntryID - string, old entry id (hex) of the
message. Note that PST provider always passes an empty old entry id, but
moving a folder or a message never changes its entry id, so the old
entry id is the same as the new one (EntryID parameter)
|
|
OnMessageMoved3 |
|
|
OnFolderMoved(EntryID) |
Fires when a folder is moved
in the store.
EntryID - string,
entry id (in hex) of the folder.
|
|
OnFolderMovedEx(EntryID,
OldParentEntryID, NewParentEntryID) |
Fires when a folder is moved
in the store.
EntryID - string,
entry id (in hex) of the folder.
OldParentEntryID - string, entry id (in hex) of the old parent
folder.
NewParentEntryID - string, entry id (in hex) of the new parent
folder.
|
|
OnFolderMoved3(EntryID,
OldParentEntryID, NewParentEntryID, OldEntryID) |
Fires when a message is moved
in the store.
EntryID - string,
entry id (in hex) of the folder.
OldParentEntryID - string, entry id (in hex) of the old parent
folder.
NewParentEntryID - string, entry id (in hex) of the new parent
folder.
OldEntryID - string, old entry id (hex) of the
folder. Note that PST provider always passes an empty old entry id, but
moving a folder never changes its entry id, so the old entry id is the
same as the new one (EntryID parameter)
|
|
OnSearchComplete(EntryID) |
Fires when an asynchronous
search in a search folder is complete
EntryID - string,
entry id (in hex) of the search folder.
|
|
|
This object represents an extension
of the RDOStore interface and introduces oadditional properties (see below).
This interface can be used for any
store (RDOExchangeStore,
RDOExchangeMailboxStore,
RDOExchangePublicFoldersStore)
|
|
|
implements all RDOStore
properties and methods |
|
Properties |
|
Categories
|
returns
RDOCategories collection representing categories from the given store
Only Outlook 2007 (or higher)
stores categories list in the default store.
|
set Session =
CreateObject("Redemption.RDOSession")
Session.logon
set Store = Session.GetSharedMailbox("dmitry")
set Categories = Store.Categories
set Category = Categories.Add("Redemption Category",
olCategoryColorPeach)
|
DisplayOrder
|
integer,, read/write. Returns or sets the store's order in the Outlook's folder
pane.
The first store has an index of 1 and the last store has an index of RDOSession.Stores.Count.
|
RDOPstStore store = session.Stores.AddPSTStore( @"c:\temp\important.pst",
Missing.Value,
"Most important store");
(store
as
RDOStore2).DisplayOrder = 2;
//second store - the
property is 1 based, not 0
|
Favorites
|
RDOFavorites, read-only.
Returns the list of folders marked as favorites in the current store.
|
|
GetFolderFromPath(FolderPath, CanCreate) |
Similar to the RDOSession.GetFolderFromPath
method, but allows to open a folder by path on the per-store level. This method
includes an optional parameter (CanCreate) that can be used to create
the folders along the path if they do not already exist..
If the folder path includes the store name (prefixed with "\\"), it is ignored.
This makes it possible to retrieve RDOFolder.FolderPath
from a folder in one store and recreate the same path in another store.
FolderPath - string, full folder path in the form "\\Store name\Parent
Folder Name\Folder". If store name is not specified, the default store is
assumed.
CanCreare - variant, optional. If true, all folders on the path
are created if necessary. Defaults to false if not specified.
|
RDOSession
session =
new
RDOSession();
session.Logon( "Test");
RDOStore store =
session.Stores.DefaultStore;
RDOStore2 store2 = store
as
RDOStore2;
RDOFolder folder =
store2.GetFolderFromPath(@"Inbox\Test
folder",
true);
MessageBox.Show(folder.Name);
|
Searches |
RDOSearches, read-only.
Returns
RDOSearchescollection that provides access
to the Outlook Search Folders.
|
set Session =
CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Searches = Session.Stores.DefaultStore.Searches
for each Search in Searches
Debug.Print "-------------"
Debug.Print Search.Name
Debug.Print Search.SearchCriteria.AsSQL
next |
|
This object represents PST (either
ANSI or Unicode) message store. Implements all RDOStore
properties and methods and exposes an additional
property: PstPath. This object is returned by the various RDO methods if
StoreKind property is either skPstAnsi or skPstUnicode.
|
|
|
implements all RDOStore
properties and methods |
|
Properties |
|
PstPath |
String. Returns a fully
qualified path to the given PST store
Important note: if you set RDOSession.MAPIOBJECT
property to Namespace.MAPIOBJECT property from the Outlook Object Model
and your code is running outside of the outlook.exe address space (i.e.
it is not a COM add-in) this property will return an error due to a MAPI
bug. |
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
for each Store in Session.Stores
if (Store.StoreKind = skPstAnsi) or (Store.StoreKind = skPstUnicode) Then
Debug.Print Store.PstPath
next |
|
Methods |
|
|
GetNicknames |
Returns
RDONickNames collection representing
nicknames stored in the store.
|
|
OverridePSTDisableGrow
|
Allows to temporarily disable
PSTDisableGrow policy on the per-PST store basis.
Note that
PSTDisableGrowAllowAuthenticodeOverrides registry value must be set
prior to calling OverridePSTDisableGrow
method since the parent registry key requires elevated rights even
though is is a child of HKEY_CURRENT_USER.
|
set
Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set
pstStore = session.GetStoreFromID(Application.ActiveExplorer.CurrentFolder.Store.StoreID)
pstStore.OverridePSTDisableGrow()
|
ValidateIPMTree |
Validates and creates (if
necessary) the following default folders in the PST store
Inbox
Outbox
Deleted Items
Sent Items
Calendar
Contacts
Drafts
Journal
Notes
Tasks
Junk E-mail
Folder Views
Common Views
Search Root
IPM Subtree
|
set Session = CreateObject("Redemption.RDOSession")
'open or create a new PST
store
Session.LogonPstStore("c:\temp\test_default_folders.pst", 1, "Test
Default Folders Store")
set Store = Session.Stores.DefaultStore
Store.ValidateIPMTree
'now create a new contact
in the default Contacts folder of the newly created PST store
set Contact =
Store.GetDefaultFolder(olFolderContacts).Items.Add
Contact.Email1Address = "test_address@dimastr.com"
Contact.FirstName = "Dmitry"
Contact.LastName = "Streblechenko"
Contact.Save |
|
This object represents an Exchange
message store. RDOExchangeMailboxStore
and RDOExchangePublicFoldersStore
are derived from this interface. Implements all RDOStore
properties and methods and exposes an additional
property: ServerDN.
|
|
|
implements all RDOStore
properties and methods |
|
Properties |
|
ServerDN |
String. Returns an Exchange
Server distinguished name |
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
for each Store in Session.Stores
if (skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) or (Store.StoreKind = skPublicFolders) Then
Debug.Print Store.ServerDN
next |
|
RDOExchangeMailboxStore object |
This object represents an Exchange
Server mailbox message store. Implements all RDOExchangeStore
properties and methods and exposes an additional
property: Owner. This object is returned by the various RDO methods if StoreKind
property is either skPrimaryExchangeMailbox or skDelegateExchangeMailbox.
|
|
|
implements all
RDOExchangeStore
properties and methods |
|
Properties |
|
AutoDiscoverUrl |
String, read-only. Returns the url pointing to the location of the
autodiscover XML for the store.
|
|
CalendarOptions |
Returns
RDOCalendarOptions object that
represents the calendaring options (auto-accept, free/busy data, etc).
Read-only.
|
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set CalendarOptions = Session.Stores.DefaultStore.CalendarOptions
CalendarOptions.AutoAccept = true
|
DaysToKeepOffline
|
Integer, read/write. Number of days to keep messages in the OST file.
Cached mode only, Outlook 2013 or newer.
|
|
Delegates |
Returns RDOMailboxDelegates
object) that allows to manage delegates for an Exchange store.
This functionality can be accessed in Outlook through File | Info |
Account and Social Network Settings | Delegate Access).
|
'enumerate delegates
skPrimaryExchangeMailbox = 3
skDelegateExchangeMailbox = 4
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
'Delegates API uses EWS, so we need to provide credentials unless
'the currently logged user is the mailbox owner
Session.Credentials.Add "*.onmicrosoft.com", "user@company.demo", "MyPassword"
Session.Credentials.Add "*.outlook.com", "user@company.demo", "MyPassword"
set Store = Session.Stores.DefaultStore
if (Store.StoreKind <> skPrimaryExchangeMailbox) and (Store.StoreKind <> skDelegateExchangeMailbox) Then
MsgBox "Delegates are only supported for the Exchange stores"
Else
set Delegates = Store.Delegates
for each Delegate in Delegates
Debug.Print Delegate.User.Name
next
End If
|
ExchangeManageStore |
Returns RDOExchangeManageStore
object.
|
skPrimaryExchangeMailbox = 3
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.DefaultStore
if (Store.StoreKind = skPrimaryExchangeMailbox) Then
set XMS = Store.ExchangeManageStore
set Table = XMS.GetMailboxTable("")
'use the current store's server DN
set Recordset = Table.ExecSQL("SELECT
""http://schemas.microsoft.com/mapi/proptag/0x3001001E"" AS
PR_DISPLAY_NAME, " & _
"
""http://schemas.microsoft.com/mapi/proptag/0x3003001E"" AS
PR_EMAIL_ADDRESS from Table")
while not Recordset.EOF
Debug.Print(Recordset.Fields("PR_DISPLAY_NAME").Value
& " - " & Recordset.Fields("PR_EMAIL_ADDRESS").Value)
Recordset.MoveNext
wend
End If
|
IsArchive
|
Boolean, read-only.
Since both delegate and archive Exchange stores are represented by the RDOExchangeMailboxStore
object and the StoreKind property returns
skDelegateExchangeMailbox for both kinds of mailboxes, IsArchive
property allows to distinguish between delegate mailboxes that belong to
another user and an archive mailbox owned by the current user.
|
'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 using
OOM
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
|
IsCached |
Boolean. read/write. Outlook
2003 and up only.
Returns true if the Exchange
mailbox is cached. Note that delegate mailboxes are never cached.
Setting this property won't
take effect until the next time MAPI logs to the profile.
Corresponds to the "Use
Cached Exchange Mode" checkbox in the Exchange provider properties
dialog. |
|
IsConsumerAccount |
Boolean, read-only.
Returns true for a free outlook.com mailbox, and false otherwise
|
|
JunkEmailOptions |
Returns
RDOJunkEmailOptions object
representing mailbox Junk E-mail options.
Note that mailbox Junk E-mail
options can be different from the profile-wide options: mailbox Junk
E-mail options can be retrieved or set for a mailbox other than the
primary mailbox in the profile (see the example)
|
'make sure messages from a
client are never marked as spam
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.GetSharedMailbox("OtherUser")
set JunkOptions = Store.JunkEmailOptions
JunkOptions.TrustedSenders.Add "@ReallyBigClient.com"
JunkOptions.Save
|
LastSyncTime
|
DateTime, read-only. The returns the time of the last sync. May not be
present on all stores.
|
|
MAPIHTTPAddressbookExternalUrl
|
String, read-only. Returns the url pointing to the external address book
endpoint for the MAPI-over-HTTP protocol.
|
|
MAPIHTTPAddressbookInternalUrl
|
String, read-only. Returns the url pointing to the internal address book
endpoint for the MAPI-over-HTTP protocol.
|
|
MAPIHTTPMailboxExternalUrl
|
String, read-only. Returns the url pointing to the external store
endpoint for the MAPI-over-HTTP protocol.
|
|
MAPIHTTPMailboxInternalUrl
|
String, read-only. Returns the url pointing to the internal store
endpoint for the MAPI-over-HTTP protocol.
|
|
MaxSubmitMessageSize
|
Integer, read-only.
Returns the maximum allowed size of the outgoing messages (in kilobytes)
|
skPrimaryExchangeMailbox = 3
skDelegateExchangeMailbox = 4
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set NewMsg = Session.GetDefaultFolder(olFolderOutbox).Items.Add
NewMsg.Subject = "testing size"
NewMsg.To = "dmitry@dimastr.com"
NewMsg.Save
set Store = Session.Stores.DefaultStore
Cancel = false
if (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) Then
if Newmsg.Size >= 1024 * Store.MaxSubmitMessageSize
Then
MsgBox "The outgoing message size exceeds the maximum allowed
size for this mailbox"
Cancel = true
End If
End If
if Not Canxel then
NewMsg.Send
End If
|
MessageSize
|
Integer (64 bit), read-only. Returns the total size of all messages in
the mailbox (bytes).
|
|
MonthsToKeepOffline
|
Integer, read/write. Number of months to keep messages in the OST file.
Cached mode only, Outlook 2013 or newer.
If 0, all messages are cached.
|
|
OstPath |
String, read only.
Returns full path to the
local OST file used to cache the mailbox.
|
|
Owner |
AddressEntry. Returns an Address Book
object that represents the owner of the mailbox
|
set Session =
CreateObject("Redemption.RDOSession")
Session.Logon
for each Store in Session.Stores
if (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) Then
Debug.Print Store.Owner.Name
next |
OutOfOfficeAssistant |
Returns an
RDOOutOfOfficeAssistant
object that allows to set the Out-Of-Office state and reply text.
|
skPrimaryExchangeMailbox = 3
skDelegateExchangeMailbox = 4
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.DefaultStore
if (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) Then
set OOFAsistant = Store.OutOfOfficeAssistant
OOFAsistant.OutOfOffice = true
OOFAsistant.OutOfOfficeText = "Sorry, I am out of office at the moment!"
Else
MsgBox "Out Of Office Assistant is only available for the Exchange
mailboxes"
End If
|
PrimaryStore
|
Returns an instance
of the
RDOExchangeMailboxStore
object that represents the primary Exchange mailbox in the given Exchange
account. E.g.. if an Exchange account has 4 stores (primary mailbox M1,
delegate mailboxes D1 and D2, and a Public Folders store P1), PrimaryStore
property for all these stores will return the primary mailbox M1.
The property was introduced to avoid
the need to access RDOStore.StoreAccount
property. RDOAccount object returned by
RDOStore.StoreAccount. wraps the
IOlkAccount MAPI object, which has thread affinity and can raise an
exception if accessed on a secondary thread. To avoid the cross-thread access
exceptions, one can, for example, use
RDOExchangeMailboxStore.PrimaryStore.Owner.SMTPAddress
in place of RDOExchangeMailboxStore.StoreAccount.CurrentUser.SMTPAddress.
|
|
QuotaReceive |
Integer, read-only. Returns the mailbox size (in kilobytes) when no new
messages will be received.
|
|
QuotaSend |
Integer, read-only. Returns the mailbox size (in kilobytes) when no new
messages will be allowed to be sent.
|
|
QuotaWarning |
Integer, read-only. Returns the mailbox size (in kilobytes) when the
mailbox owner receives a warning when a new message is received or sent.
|
|
Rules |
RDORules, read-only. Returns a collection
representing rules defined for the given mailbox.
|
set Session =
CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Rules = Session.Stores.DefaultStore.Rules 'will raise an error if
not an Exchange store
for each Rule in Rules
Debug.Print Rule.Name
next |
ServerName
|
String, read only.
Returns the network name of
the server that hosts the mailbox.
|
|
ServerVersion
|
String, read only.
Returns the version of the
server that hosts the mailbox, e. g. "14.1.289.4001".
|
|
Templates
|
Returns
RDOTemplates collection representing templates in
the mailbox.
|
|
|
Methods |
|
GetFolderFromSourceKey(SourceKey) |
Returns a folder (RDOFolder)
object corresponding to the given source key (PR_SOURCE_KEY).
SourceKey - the value
of the PR_SOURCE_KEY. Either a variant array of bytes as returned by
RDOFolder.Fields() or a string with a hex
representation of PR_SOURCE_KEY.
Normally folders can be
reopened using RDOSession.GetFolderFromID
or RDOStore.GetFolderFromID, but under
Exchange the values of entry ids can differ depending on how the object
is opened (e.g. whether it comes from the primary Exchange mailbox or a
delegate mailbox, etc).
The value of
PR_SOURCE_KEY for a given folder or message is always the same.
GetFolderFromSourceKey and GetMessageFromSourceKey allow to
retrieve folders and messages when, for example, the folder or a message
is retrieved by one user, stored in an external DB and then ubsequently
retrieved in another user's context.
This method only works in the
online mode: the profile used in RDOSession.Logon
must either be configured to be in the online mode or
RDOSession.LogonExchangeMailbox must
be used.
|
PR_SOURCE_KEY = &H65E00102
skPrimaryExchangeMailbox = 3
skDelegateExchangeMailbox = 4
skPublicFolders = 5
'retrieve the values of source keys for a message and its parent
folder
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg =
Session.GetMessageFromID(Application.ActiveExplorer.Selection.Item(1).EntryID)
MessageSourceKey = Msg.Fields(PR_SOURCE_KEY)
FolderSourceKey = Msg.Parent.Fields(PR_SOURCE_KEY)
'convert the source keys to hex strings suitable for storage
'in a database.
'GetMessageFromSourceKey and GetFolderFromSourceKey can take either a
variant
'array of bytes as returned by Fields() for the PT_BINARY properties or
a hex string, so it works either way
set Utils = CreateObject("Redemption.MAPIUtils")
strMessageSourceKey = Utils.HrArrayToString(MessageSourceKey)
strFolderSourceKey = Utils.HrArrayToString(FolderSourceKey)
'we can (now or later) use the values of the source keys to reopen a
messsage or a folder
set Store = Session.Stores.DefaultStore
if (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind =
skDelegateExchangeMailbox) or (Store.StoreKind = skPublicFolders) Then
set NewMsg = Store.GetMessageFromSourceKey(strFolderSourceKey,
strMessageSourceKey)
MsgBox "Message subject: " & NewMsg.Subject
set NewFolder = Store.GetFolderFromSourceKey(strFolderSourceKey)
MsgBox "Folder name: " & NewFolder.Name
End If
|
GetMessageFromSourceKey(FolderSourceKey,
MessageSourceKey) |
Returns a message (RDOMail,
RDOContactItem, etc depending on the
message class) object corresponding to the given source key
(PR_SOURCE_KEY).
FolderSourceKey - the
value of the parent folder's PR_SOURCE_KEY property. Either a variant
array of bytes as returned by RDOFolder.Fields()
or a string with a hex representation of PR_SOURCE_KEY.
MessageSourceKey - the
value of the message PR_SOURCE_KEY property. Either a variant array of
bytes as returned by RDOFolder.Fields() or a
string with a hex representation of PR_SOURCE_KEY.
See GetFolderFromSourceKey
above. |
|
GetNicknames |
Returns
RDONickNames collection representing
nicknames stored in the store. |
|
GetOutOfOfficeAssistantWithCredentials
(UserName, Password) |
Similar to the OutOfOfficeAssistant property. returns an
RDOOutOfOfficeAssistant
object that allows to set the Out-Of-Office state and reply text, but
also allows to specify the user name and password.
|
|
GetOwaNicknames
|
Returns
RDONickNames collection representing
nicknames used by OWA in Exchange 2010. Unlike the nicknames returned
from
GetNicknames, this collection is read-only.
|
|
MakeEwsRequest(Data) |
Similar to the
mailbox.MakeEwsRequestAsync method exposed for the Web (JS) addins by
Outlook. Unlike the JavaScript equivalent, MakeEwsRequest in
Redemption is synchronous and is expected to run on a secondary thread (see
here for more on using Redemption in secondary
threads). There are no limitation which EWS call can be made.
Note that MakeEwsRequest is designed to work in COM
(VSTO) addins or Outlook VBA as it intercepts EWS requests made by Outlook
itself to extract the credentials. It will work outside of the outlook.exe
process only if Outlook cached the credentials or if RDOSession.LogonHostedExchangeMailbox
was used to connect to Exchange (which requires explicit credentials). Also note
that it is expected that the parent RDOSession
object is created well ahead of time (e.g. when the COM/VSTO addin is loaded)
prior to calling MakeEwsRequest to allow Redemption sufficient
time to collect the credentials after Outlook makes its own EWS calls.
Data - string. XML request payload
Returns XML string with the server reply |
payload = _
"<?xml
version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope
xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""" & _
"
xmlns:t=""http://schemas.microsoft.com/exchange/services/2006/types"">" & _
"
<soap:Header><t:RequestServerVersion
Version=""Exchange2007_SP1""/></soap:Header>" & _
"
<soap:Body>" & _
"
<GetDelegate
xmlns=""http://schemas.microsoft.com/exchange/services/2006/messages""" & _
"
xmlns:t=""http://schemas.microsoft.com/exchange/services/2006/types""" & _
"
IncludePermissions=""true"">" & _
"
<Mailbox>" & _
"
<t:EmailAddress>" & smtpAddress &
"</t:EmailAddress>" & _
"
</Mailbox>" & _
"
</GetDelegate>" & _
"
</soap:Body>" & _
"</soap:Envelope>"
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set defaultAccount = Session.Accounts.GetOrder(1).Item(1)
if TypeName(defaultAccount) =
"RDOExchangeAccount"
Then
MsgBox
"This message box simulates a delay between creating RDOSession object " & _
"and a call to MakeEwsRequest to allow it to intercept EWS calls made by
Outlook"
Session.CacheAutoDiscoverXml smtpAddress,
Application.Session.AutoDiscoverXml
'speed things up
reply =
defaultAccount.MakeEwsRequest(payload)
MsgBox reply
End
If
|
|
RDOExchangePublicFoldersStore object |
This object represents an Exchange
Server mailbox message store. Implements all RDOExchangeStore
properties and methods. There are no additional
properties at this time. This object is returned by the various RDO methods if
StoreKind property is skPublicFolders.
|
|
|
implements all
RDOExchangeStore
properties and methods |
|
Properties |
|
ExchangeManageStore |
Returns RDOExchangeManageStore
object.
|
skPrimaryExchangeMailbox = 3
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.DefaultStore
if (Store.StoreKind = skPrimaryExchangeMailbox) Then
set XMS = Store.ExchangeManageStore
set Table = XMS.GetMailboxTable("")
'use the current store's server DN
set Recordset = Table.ExecSQL("SELECT
""http://schemas.microsoft.com/mapi/proptag/0x3001001E"" AS
PR_DISPLAY_NAME, " & _
"
""http://schemas.microsoft.com/mapi/proptag/0x3003001E"" AS
PR_EMAIL_ADDRESS from Table")
while not Recordset.EOF
Debug.Print(Recordset.Fields("PR_DISPLAY_NAME").Value
& " - " & Recordset.Fields("PR_EMAIL_ADDRESS").Value)
Recordset.MoveNext
wend
End If
|
|
|
|
IsCached |
Boolean. read/write. Outlook
2003 and up only.
Returns true if the Exchange
mailbox is cached. Note that delegate mailboxes are never cached.
Setting this property won't
take effect until the next time MAPI logs to the profile.
Corresponds to the "Download
Public Folder Favorites" checkbox in the Exchange provider properties
dialog. |
|
PrimaryStore
|
Returns an instance
of the
RDOExchangeMailboxStore
object that represents the primary Exchange mailbox in the given Exchange
account. E.g.. if an Exchange account has 4 stores (primary mailbox M1,
delegate mailboxes D1 and D2, and a Public Folders store P1), PrimaryStore
property for all these stores will return the primary mailbox M1.
The property was introduced to avoid
the need to access RDOStore.StoreAccount
property. RDOAccount object returned by
RDOStore.StoreAccount. wraps the
IOlkAccount MAPI object, which has thread affinity and can raise an
exception if accessed on a secondary thread. To avoid the cross-thread access
exceptions, one can, for example, use
RDOExchangeMailboxStore.PrimaryStore.Owner.SMTPAddress
in place of RDOExchangeMailboxStore.StoreAccount.CurrentUser.SMTPAddress.
|
|
|
Methods |
|
GetFolderFromSourceKey(SourceKey)
|
See
RDOExchangeMailboxStore.GetFolderFromSourceKey
above
|
|
GetMessageFromSourceKey(FolderSourceKey,
MessageSourceKey)
|
See
RDOExchangeMailboxStore.GetMessageFromSourceKey
above
|
|
|
|
|
This object represents an Exchange
Active Sync (EAS) store.
|
|
|
implements all RDOStore2
properties and methods |
|
Properties |
|
OstPath |
String, read only.
Returns full path to the
local OST file used to cache the mailbox.
|
|
Owner |
RDOAddressEntry, read-only. Return the
address entry object representing the store owner.
|
|
|
|
|
|
|