Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / February 2004

Tip: Looking for answers? Try searching our database.

iterating folder collection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anushya - 22 Feb 2004 15:17 GMT
Hi

when i try to browse thru all the folders in outlook recursively
starting from the root folder,  i couldnot explore the USER FOLDERS
which comes straight under  root folder.

Wot is the problem,
1)i am using folders(1) as the root folder??
2)Or the user folders created under root folder will not come under
root folder while exploring???

see my edited code below

IterateFolder(oNs.Folders[1]);           

public static void IterateFolder(Microsoft.Office.Interop.Outlook.MAPIFolder
oFldr)
{
for(int intL = 1;intL <= oFldr.Folders.Count;intL++)
 IterateFolder(oFldr.Folders[intL]);
}

Thanks
Anushya
Sue Mosher [MVP-Outlook] - 22 Feb 2004 20:33 GMT
There's no way to know for certain what folders(1) is. If you want to
iterate all folders, you should iterate all members of the oNs.Folders
collection. If you want to iterate only the user's default store, use
Namespace.GetDefaultFolder to return the Inbox, then get the Inbox folder's
Parent and start your iteration from that folder's Folders collection.
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Hi
>
[quoted text clipped - 20 lines]
> Thanks
> Anushya
Anushya - 23 Feb 2004 03:51 GMT
Thanks Sue. It works
Microsoft.Office.Interop.Outlook.MAPIFolder oOlInboxFolder =
oOutlookNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

IterateFolder((Microsoft.Office.Interop.Outlook.MAPIFolder)oOlInboxFolder.Parent);
Anushya
> There's no way to know for certain what folders(1) is. If you want to
> iterate all folders, you should iterate all members of the oNs.Folders
[quoted text clipped - 26 lines]
> > Thanks
> > Anushya
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.