|
RDODeletedFolders collection |
RDODeletedFolders collection represents the
deleted (but recoverable) folders from a given RDOFolder object.
Exchange only in the online mode.
This collection is derived form the
RDOFolders collection and implements all of its
properties and methods.
It overrides the behavior of the
Add method (an error will be raised) and adds the Restore method (see
below).
Note that due to the Exchange
provider limitations, RDOFolder.Items and RDOFolder.Folders
collections for the deleted folder will return 0 items even if there messages
and subfolders. You will need to restore
the folder first before you can access its messages and subfolders.
Returned by:
RDOFolder.DeletedFolders
The example below logs to the default
MAPI session and restores all deleted subfolders in the Inbox:
set Session =
CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetDefaultFolder(olFolderInbox)
set DeletedFolders = Folder.DeletedFolders
for i = DeletedFolders.Count to 1 step -1
set RestoredFolder = DeletedFolders.Restore(i)
Debug.Print "Successfully restored folder: " & RestoredFolder.Name
next |
|
|
Implements all RDOFolders properties and
methods: Count, RawTable, Session, _Item(), MAPITable, Add, GetFirst,
GetLast, GetNext, GetPrevious, Item(), Remove |
|
|
Methods |
|
Restore(Index,
DestinationFolder, Move) |
Restores a folder with a
given index or a name.
Returns
RDOFolder object
Index - variant:
integer (1 through Count) or a string (folder name)
DestinationFolder -
optional,
RDOFolder. Allows specifying the destination folder where the deleted
folder will be restored. If not specified, the deleted folder will be
restored to its parent folder.
Move - optional,
boolean. If true, the folder will be removed from the deleted folders
collection. If not specified, defaults to false.
|
'Log to the default
MAPI session and
'restore all deleted
subfolders in the Inbox to the Drafts folder
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetDefaultFolder(olFolderInbox)
set DestFolder = Session.GetDefaultFolder(olFolderDrafts)
set DeletedFolders = Folder.DeletedFolders
for i = DeletedFolders.Count to 1 step -1
set RestoredFolder = DeletedFolders.Restore(i, DestFolder, true)
Debug.Print "Successfully restored folder: " & RestoredFolder.Name
next
|
|