473,320 Members | 1,821 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,320 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 944

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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.