Programmatically hiding Outlook folders

  • Thread starter Thread starter Leon
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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?
 
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
 
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
 
Back
Top