473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Outlook 2000 and VB.NET

Here is a rundown of what I'm trying to do:

-Pass in a string from a config file that would look something like "Sent
Items, Old Sent Items"

-Split that string by the comma into an array

-If the string is not nothing then drop into a for loop. For j=1 to the
upper bound of the array, the folder variable .Folders.Item property equals
the string in the element of the array. After that, if the folder variable
is nothing then exit the for loop.

Unfortunately, it breaks on the last part and only gives me the very
non-descriptive "The operation failed. An Object could not be found." error.
Here is the code in question:

arrFolders = Split(folder, ",")
oFolder = oNS.Folders.Item(user)
If Not folder Is Nothing Then
For j = 1 To UBound(arrFolders)
oFolder = oFolder.Folders.Item(arrFolders(j))
oItems = oFolder.Items
If folder Is Nothing Then
Exit For
End If
Next
End If

Interestingly, I have a work around, but it would basically be hard coded,
which isn't acceptible. I would basically just have to oFolder =
oFolder.Folders.Item statements with each element hard coded. Why does this
break when all I'm trying to do is pass in a value from an array?

If I take out all the conditionals and loops and just have the directory
only go one level deep it works as well. This code works:

oFolder = oNS.Folders.Item(user)
oFolder = oFolder.Folders.Item(folder)
oItems = oFolder.Items

Where folder = Sent Items and user = the top level directory. Can someone
please explain why it breaks on the array, and better yet...how to fix it?!?
Jul 21 '05 #1
0 947

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

Similar topics

2
by: Fritz Switzer | last post by:
Can anyone provide a small snippet in C# that pulls out the Contacts in Outlook XP. I've seen a couple of examples in C++ and VB in previous newsgroup posts, but either the originals didn't work...
3
by: Kurt | last post by:
Hi We are developing an off-the-shelf software suite for a certain business sector. Most of the program is simply a GUI on top of some .mdb files. Its a .net application written in c# One...
0
by: willockguard-newsgoups | last post by:
We successfully run an Access 97 database which has used Outlook 200 as an e-mail server. Outlook 2000 was referenced using: Dim appOutlook As New Outlook.Application Dim itm As Outlook.MailItem...
1
by: Richard | last post by:
All, I am writing an Outlook 2000 Add-In .DLL program. I have applied the necessary knowledge base fixes to enable event handling in Outlook 2000 and everything is working except for one...
4
by: John | last post by:
Hi I would like my app to target outlook 2000 and above, but since two versions of outlook can not exist on the same machine, I only have outlook 2002. How can I develop for outlook 2000? ...
4
by: Nathan Carroll | last post by:
Why am I able to use this in Outlook and not do the same from .Net. My problems centers around the Items in the xp version of below i used the interop references. Does something similar exist for...
10
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am...
6
by: Ernie | last post by:
We have an Outlook 2000 VBA application - 8 user forms, and about a thousand lines of code - that we wish to distribute. We know that we can password-protect the code, but that does not give us the...
8
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003....
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.