473,937 Members | 15,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iterating folder collection

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(o Ns.Folders[1]);

public static void IterateFolder(M icrosoft.Office .Interop.Outloo k.MAPIFolder
oFldr)
{
for(int intL = 1;intL <= oFldr.Folders.C ount;intL++)
IterateFolder(o Fldr.Folders[intL]);
}

Thanks
Anushya
Nov 15 '05 #1
2 2645
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.GetDe faultFolder to return the Inbox, then get the Inbox folder's
Parent and start your iteration from that folder's Folders collection.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Anushya" <v_*******@hotm ail.com> wrote in message
news:80******** *************** ***@posting.goo gle.com...
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(o Ns.Folders[1]);

public static void IterateFolder(M icrosoft.Office .Interop.Outloo k.MAPIFolder oFldr)
{
for(int intL = 1;intL <= oFldr.Folders.C ount;intL++)
IterateFolder(o Fldr.Folders[intL]);
}

Thanks
Anushya

Nov 15 '05 #2
Thanks Sue. It works
Microsoft.Offic e.Interop.Outlo ok.MAPIFolder oOlInboxFolder =
oOutlookNs.GetD efaultFolder(Ol DefaultFolders. olFolderInbox);

IterateFolder(( Microsoft.Offic e.Interop.Outlo ok.MAPIFolder)o OlInboxFolder.P arent);
Anushya
"Sue Mosher [MVP-Outlook]" <su****@outlook code.com> wrote in message news:<uB******* *******@TK2MSFT NGP12.phx.gbl>. ..
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.GetDe faultFolder to return the Inbox, then get the Inbox folder's
Parent and start your iteration from that folder's Folders collection.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Anushya" <v_*******@hotm ail.com> wrote in message
news:80******** *************** ***@posting.goo gle.com...
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(o Ns.Folders[1]);

public static void

IterateFolder(M icrosoft.Office .Interop.Outloo k.MAPIFolder
oFldr)
{
for(int intL = 1;intL <= oFldr.Folders.C ount;intL++)
IterateFolder(o Fldr.Folders[intL]);
}

Thanks
Anushya

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1828
by: Patrick von Harsdorf | last post by:
I want to iterate over a collection and delete all unwanted entries. for item in collection: del item of course doesn´t do anything useful. Two things come to mind: a) iterating backwards over the collection using indexing, something like: for i in range(len(collection)-1, -1, -1): item = collection
1
5403
by: Lise | last post by:
Hi all .. I have a directory with several subdirectories and a number of files in each. These files are accessed by going to a web page and clicking in a listbox and navigating to the desired file. Currently, when a new file is added to one of the sub directories, a new link must be added to the web page to add the new file to the listbox ... yes .... a very manually
6
6076
by: Gustaf Liljegren | last post by:
I ran into this problem today: I got an array with Account objects. I need to iterate through this array to supplement the accounts in the array with more data. But the compiler complains when I try to modify the objects in the array while iterating through it. I marked the bugs in this code: // Loop through all previously added accounts foreach(Account a in a1) // a1 is an ArrayList { // If name and context is the same if(a.Name ==...
10
15176
by: Ken Foster | last post by:
I have a hashtable keyed by some name, holding an instance of an object. Most of the time I use the hashtable in the traditional sense, given a name, I lookup the object, then I run a method on that object. Occaisionally however I need to run a method on every object in the hashtable. I've done both For..Each and iEnumeratior loops. The messy part is that under certain conditions, while iterating, a condition exists where I need to remove...
2
5056
by: David Veeneman | last post by:
Is there a way to iterate the components on a form? I need to determine whether an instance of my custom component (a System.ComponentModel component) is present in a form. I have tried iterating the Controls collection, but components do not appear to be in that collection-- I think it's because components inherit from MarshalByRefObject, rather than Control. So, how do I find a form's components collection? Thanks in advance.
2
1823
by: MarkAurit | last post by:
Ive been using arraylists in 1.1 to return collections of custom business objects, and thoroughly enjoyed their simple programming style. After hearing of the advantages of generics during a 2.0 app, I decided to try one. I changed a "GetCollectionOfObjects"-type method to return a List<custom object>, instantiated objects,and added them to the List. Worked great. My final step was to iterate through them, and there's the rub. Foreach...
1
1743
by: shiniskumar | last post by:
how to delete the last element of a collection without iterating it?
5
1969
by: mikehulluk | last post by:
Ok, Imagine I have a class class C { }; ostream& operator<<(ostream& o, const C& c) { ...}
0
10123
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9955
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11078
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11268
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10641
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9846
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8202
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6063
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6272
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.