Programmatically hiding Outlook folders

L

Leon

I have a VB Add-In that uses a number of folders for temporary storage. Is
there a method or a property that Outlook exposes that would allow me to
make that folders invisible to the end user, but still give me access to all
of the items contained within?

Thank You

-Leon
 
D

Dmitry Streblechenko \(MVP\)

No. You can use a folder in the non-IPM tree (only IPM tree in any message
store is visible to a user) or you can use associated (aka hidden) messages
in a folder.
Extended MAPI, CDO 1.21 or Redemption would let you do that, Outlook Object
Model does not provide access to this functionality.

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

Henry Gusakovsky

Try to use PR_ATTR_HIDDEN property
PROP_TAG(PT_BOOLEAN, 0x10F4)
if it is "true" folder is not shown in the hierarhy.
Set it via CDO, ExMAPI or Redemtion library.

It works for me in Outlook XP.


WBR
Henry
 
L

Leon

Thank You very much for clearing this up, Dmitry!
Dmitry Streblechenko (MVP) said:
No. You can use a folder in the non-IPM tree (only IPM tree in any message
store is visible to a user) or you can use associated (aka hidden) messages
in a folder.
Extended MAPI, CDO 1.21 or Redemption would let you do that, Outlook Object
Model does not provide access to this functionality.

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

Dmitry Streblechenko \(MVP\)

Sure. The code below assumes the MAPIFolder variable points to an Outlook
folder.

set sFolder = CreateObject("Redemption.MAPIFolder")
sFolder.Item = MAPIFolder
set Items = sFolder.HiddenItems
'search by subject
set HiddenMsg = Items.Item("My config message")
If (HiddenMsg is Nothing) Then
set HiddenMsg = Items.Add("IPM.Note.MyProduct.Config")
'set the subject so we can find this message next time
HiddenMsg.Subject = "My config message"
End If
'do something with the message, set properties, etc
....
HiddenMsg.Save


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

Leon Dragan

I may be missing something but looks like this code will create a hidden
item (appointment, mail, contact), whereas what I need
to do is hide an entire folder. Is that possible?
 
D

Dmitry Streblechenko \(MVP\)

Correct. This code creates an invisible message in an existing folder.
To create an invisible folder, you will need to get to the top folder of the
message store, which is different from the top folder visible to the user.
The following code will create an invisible folder using CDO:

set RootFolder = CDOSession.GetFolder("")
set InvisibleFolder = RootFolder.Folders.Add("My invisible folder")

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

Leon Dragan

Works great. Thanks a lot.
Dmitry Streblechenko (MVP) said:
Correct. This code creates an invisible message in an existing folder.
To create an invisible folder, you will need to get to the top folder of the
message store, which is different from the top folder visible to the user.
The following code will create an invisible folder using CDO:

set RootFolder = CDOSession.GetFolder("")
set InvisibleFolder = RootFolder.Folders.Add("My invisible folder")

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top