How to programatically open Outlook folder list

  • Thread starter Thread starter NicMic
  • Start date Start date
N

NicMic

Hi,

I'm using a Redemption email filtering solution and having problems with
emails placed into folders far down the tree. For example, consider Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed and my
Redemption VBA moves an incoming email into the "Bank" folder, I want to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
....
Set mrdoSession = CreateObject("Redemption.rdoSession")
....
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
....
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
....
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank" folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM), please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
Use the Outlook object model to set ActiveExplorer.CurrentFolder to the
desired folder.
 
Set the Application.ActiveExplorer.CurrentFolder property to an instance of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Set the Application.ActiveExplorer.CurrentFolder property to an instance of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Thanks Dmitry and Ken, but the problem I'm having is converting the
Redemption object reference to an Outlook one.

I've tried the following: -
rdoMailItem.Move rdoDestFldr
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr
and
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr.MAPIOBJECT

which (as I expected) results in Err 13 Type Mismatch.

I'm sorry to be dense, but this is not my area of expertise. How can I
convert a Redemption object ref. to Outlook?

Nick.


Dmitry Streblechenko said:
Set the Application.ActiveExplorer.CurrentFolder property to an instance of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Hi,

I'm using a Redemption email filtering solution and having problems with
emails placed into folders far down the tree. For example, consider
Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed and
my
Redemption VBA moves an incoming email into the "Bank" folder, I want to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
...
Set mrdoSession = CreateObject("Redemption.rdoSession")
...
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
...
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
...
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank" folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM), please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
Try

rdoMailItem.Move rdoDestFldr
set oomDestFolder = Application.Session.GetFolderFromID(rdoDestFldr.EntryID)
Set Application.ActiveExplorer.CurrentFolder = oomDestFolder


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Thanks Dmitry and Ken, but the problem I'm having is converting the
Redemption object reference to an Outlook one.

I've tried the following: -
rdoMailItem.Move rdoDestFldr
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr
and
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr.MAPIOBJECT

which (as I expected) results in Err 13 Type Mismatch.

I'm sorry to be dense, but this is not my area of expertise. How can I
convert a Redemption object ref. to Outlook?

Nick.


Dmitry Streblechenko said:
Set the Application.ActiveExplorer.CurrentFolder property to an instance
of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Hi,

I'm using a Redemption email filtering solution and having problems
with
emails placed into folders far down the tree. For example, consider
Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed
and
my
Redemption VBA moves an incoming email into the "Bank" folder, I want
to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
...
Set mrdoSession = CreateObject("Redemption.rdoSession")
...
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
...
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
...
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank"
folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM),
please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
Thanks Dmitry - it's now working perfectly. As I use Option Explicit, I had
to declare oomDestFolder - I used "Object". What type should it be, or does
it not really matter?

Dmitry Streblechenko said:
Try

rdoMailItem.Move rdoDestFldr
set oomDestFolder = Application.Session.GetFolderFromID(rdoDestFldr.EntryID)
Set Application.ActiveExplorer.CurrentFolder = oomDestFolder


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Thanks Dmitry and Ken, but the problem I'm having is converting the
Redemption object reference to an Outlook one.

I've tried the following: -
rdoMailItem.Move rdoDestFldr
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr
and
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr.MAPIOBJECT

which (as I expected) results in Err 13 Type Mismatch.

I'm sorry to be dense, but this is not my area of expertise. How can I
convert a Redemption object ref. to Outlook?

Nick.


Dmitry Streblechenko said:
Set the Application.ActiveExplorer.CurrentFolder property to an instance
of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I'm using a Redemption email filtering solution and having problems
with
emails placed into folders far down the tree. For example, consider
Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed
and
my
Redemption VBA moves an incoming email into the "Bank" folder, I want
to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
...
Set mrdoSession = CreateObject("Redemption.rdoSession")
...
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
...
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
...
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank"
folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM),
please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
It is Outlook.MAPIFolder

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Thanks Dmitry - it's now working perfectly. As I use Option Explicit, I
had
to declare oomDestFolder - I used "Object". What type should it be, or
does
it not really matter?

Dmitry Streblechenko said:
Try

rdoMailItem.Move rdoDestFldr
set oomDestFolder =
Application.Session.GetFolderFromID(rdoDestFldr.EntryID)
Set Application.ActiveExplorer.CurrentFolder = oomDestFolder


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Thanks Dmitry and Ken, but the problem I'm having is converting the
Redemption object reference to an Outlook one.

I've tried the following: -
rdoMailItem.Move rdoDestFldr
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr
and
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr.MAPIOBJECT

which (as I expected) results in Err 13 Type Mismatch.

I'm sorry to be dense, but this is not my area of expertise. How can I
convert a Redemption object ref. to Outlook?

Nick.


:

Set the Application.ActiveExplorer.CurrentFolder property to an
instance
of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I'm using a Redemption email filtering solution and having problems
with
emails placed into folders far down the tree. For example, consider
Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed
and
my
Redemption VBA moves an incoming email into the "Bank" folder, I
want
to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
...
Set mrdoSession = CreateObject("Redemption.rdoSession")
...
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
...
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
...
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank"
folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM),
please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
Sorry - should have guessed that one!

Thanks again,
Nick.


Dmitry Streblechenko said:
It is Outlook.MAPIFolder

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
NicMic said:
Thanks Dmitry - it's now working perfectly. As I use Option Explicit, I
had
to declare oomDestFolder - I used "Object". What type should it be, or
does
it not really matter?

Dmitry Streblechenko said:
Try

rdoMailItem.Move rdoDestFldr
set oomDestFolder =
Application.Session.GetFolderFromID(rdoDestFldr.EntryID)
Set Application.ActiveExplorer.CurrentFolder = oomDestFolder


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Thanks Dmitry and Ken, but the problem I'm having is converting the
Redemption object reference to an Outlook one.

I've tried the following: -
rdoMailItem.Move rdoDestFldr
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr
and
Set Application.ActiveExplorer.CurrentFolder = rdoDestFldr.MAPIOBJECT

which (as I expected) results in Err 13 Type Mismatch.

I'm sorry to be dense, but this is not my area of expertise. How can I
convert a Redemption object ref. to Outlook?

Nick.


:

Set the Application.ActiveExplorer.CurrentFolder property to an
instance
of
the Outlook.MAPIFolder object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Hi,

I'm using a Redemption email filtering solution and having problems
with
emails placed into folders far down the tree. For example, consider
Inbox -->
Personal --> Finance --> Bank. If the "Personal" folder is collapsed
and
my
Redemption VBA moves an incoming email into the "Bank" folder, I
want
to
programatically open that folder so I can see the email has arrived.

Code snippets follow to (hopefully) make it more clear: -
Private mrdoSession As Redemption.rdoSession
...
Set mrdoSession = CreateObject("Redemption.rdoSession")
...
Public Sub EmailIn(pobjMailItem As Outlook.MailItem)
Dim rdoMailItem As Redemption.RDOMail
Dim rdoDestFldr As Redemption.RDOFolder
Set rdoMailItem = mrdoSession.GetMessageFromID(pobjMailItem.EntryID)
...
[Check email details and decide where it should go]
Set rdoDestFldr = [chosen dest]
...
rdoMailItem.Move rdoDestFldr

So, the above Move method has put the incoming email into my "Bank"
folder
and I want to expand the tree so I can see it in the Outlook window
(otherwise I won't know it's there).

I just know the solution to this is so simple I'll kick myself.

If any more detail is required (perhaps the entire VbaProject.OTM),
please
let me know.

Outlook 2003, 11.8217.8221
Redemption V4.4

TIA,
Nick Michell.
 
Back
Top