Need help listing another users folders

R

Rog

Need help listing another users folders

Folks I need help with this.

We have a mailbox that's used to receive helpdesk-like requests. Several
people attach to it by adding the Exchange entry to their email setup.
I need to write a simple script to write the list of folders under a
top-level folder to a file.

I’ve written a script that writes my folders to a file just fine, and I have
tried using GetSharedDefaultFolder to get the default Inbox of the helpdesk
account, but I’m stuck.
The code is blowing up at the “Set MyCollection†line. The problem may be
that the top-level folder is at the same level as the Inbox, not under it.
Ideally I would like to run this as VBScript from outside of Outlook, but
I’ll consider other options.

Any and all help will be greatly appreciated!

My code so far:

Set Application = CreateObject("Outlook.Application")
Set myNameSpace = Application.GetNameSpace("MAPI")
Set myRecipient = myNameSpace.CreateRecipient("helpdesk-accnt")

myRecipient.Resolve
Set InboxFolder = myNameSpace.GetSharedDefaultFolder(myRecipient, 6)
Set MyCollection = InboxFolder.Folders("Top Level Task, Items, Problems")

For I = 1 to MyCollection.Count
set MyFolder = myCollection.Item(i)
MsgBox MyFolder.Name, vbInformation
Next
 
S

Sue Mosher [MVP-Outlook]

You need to start with the myNameSpace.Folders collection. This will contain the root folders of all the information stores visible in the folder list, including the user's own mailbox (i.e. inbox.Parent), the Public Folders hierarchy, any .pst files, and any secondary mailboxes. Each MAPIFolder object in that collection will have its own Folders collection for you to iterate.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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