how to refer to a service mail box

S

sparkle_guy

I have written the following code to count and then loop through the items
in my inbox
Set objOL = CreateObject("Outlook.Application")

Set objNS = objOL.GetNameSpace("MAPI")

Set objFolder = objNS.GetDefaultFolder(6)

num = objFolder.items.Count

I have also added to my outlook another mail box set up or our exchange
server. I can see it as a separtate mail box on my folder list.

I'd like to count the items in that too can anyone tell me how to refer to
it in a similar way to the above.

Thanks in advance Paul
 
D

Dmitry Streblechenko \(MVP\)

Use the Namespace.Folders collection - it includes all top level folders in
all stores.

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

Guest

Thanks for the reply my problem is I dont know how to
refer to the other folders. The mail box is shown in my
folder list as Mailbox _GBPA Service ZT and then has the
same structure as my Outlook today mail box. I want to
refer to the Inbox in _GBPA Service ZT folder.
Thanks in advanvce
 
S

Sue Mosher [MVP-Outlook]

PMJI, but what Dmitry is saying is that you need to walk the folder
hierarchy using the Folders collections, starting with Namespace.Folders.
The top level folder of that mailbox is objNamespace.Folders("Mailbox - GBPA
Service ZT"), and that folder itself has a folder collection. You can either
take it from there, getting each subfolder by name in turn, or use a
function that does that for you. See
http://www.outlookcode.com/d/code/getfolder.htm
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

sparkle_guy

Thanks Sue I cottoned on in the end and worked it out but thanks for taking
the time to reply.
Paul
 

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