473,396 Members | 1,996 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,396 software developers and data experts.

Getting specified cast error while taking data from outlook

I am trying to take contacts data from out look and Synchronize with our database. I am using .net 1.1 framework.
iam using following code.

OLCont = MyOLList.GetLast 'CType(item, outlook.ContactItem)
Do While TypeName(OLCont) <> "Nothing"
OLRow = OLTable.NewRow
OLRow(0) = 0
OLRow(1) = IIf(OLCont.FirstName Is Nothing, "", OLCont.FirstName)
OLRow(2) = IIf(OLCont.MiddleName Is Nothing, "", OLCont.MiddleName)
OLRow(3) = IIf(OLCont.LastName Is Nothing, "", OLCont.LastName)
OLRow(4) = IIf(OLCont.FullName Is Nothing, "", OLCont.FullName)
OLTable.Rows.Add(OLRow)
OLCont = MyOLList.GetPrevious
Loop


problem is when i run this code in windows 2000 systems with outlook 2003 running properly. Its retrieving all contacts records from outlook properly

same code throws "specified cast not valid" error when i run in windows xp (service pack 2 ) with outlook 2003. some contacts records are retrieved but not all.

while parsing through contacts records only we are getting the above error.

please help me in this.
May 24 '07 #1
2 1567
prabunewindia
199 100+
hi friend,
you used one method "IIf"
is this your pwn method?
if yes then give that code also?
and tell me in which line it throwing the error
Prabu

I am trying to take contacts data from out look and Synchronize with our database. I am using .net 1.1 framework.
iam using following code.

OLCont = MyOLList.GetLast 'CType(item, outlook.ContactItem)
Do While TypeName(OLCont) <> "Nothing"
OLRow = OLTable.NewRow
OLRow(0) = 0
OLRow(1) = IIf(OLCont.FirstName Is Nothing, "", OLCont.FirstName)
OLRow(2) = IIf(OLCont.MiddleName Is Nothing, "", OLCont.MiddleName)
OLRow(3) = IIf(OLCont.LastName Is Nothing, "", OLCont.LastName)
OLRow(4) = IIf(OLCont.FullName Is Nothing, "", OLCont.FullName)
OLTable.Rows.Add(OLRow)
OLCont = MyOLList.GetPrevious
Loop


problem is when i run this code in windows 2000 systems with outlook 2003 running properly. Its retrieving all contacts records from outlook properly

same code throws "specified cast not valid" error when i run in windows xp (service pack 2 ) with outlook 2003. some contacts records are retrieved but not all.

while parsing through contacts records only we are getting the above error.

please help me in this.
May 24 '07 #2
hi friend,
you used one method "IIf"
is this your pwn method?
if yes then give that code also?
and tell me in which line it throwing the error
Prabu

IIF is not my own method its a in build function in Vb.net

iam getting error in the following line

OLCont = MyOLList.GetPrevious

problem is it not coming windows 2000 system but coming in XP system

Also if 100 contacts are there means it parse till some 50 then throughing the error. i think the out look object may be corrupting while process through the records. still problem is not solved
Jun 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tao | last post by:
I just upgraded .NET framework to 1.1 and VS.Net to 2003 version and tried to test it out. I created an ASP.NET project using the wizard and tried to run it by hitting "F5". I got an exception:...
11
by: Jim H | last post by:
I am trying to go through my Outlook (2003) address book. The code goes through the Items list and prints all the last names but after it hits 114 (out or 126 contacts) I get a "sepcified cast is...
4
by: Tyro | last post by:
Can someone shed some light on my error here? Thanks! Specified cast is not valid. Exception Details: System.InvalidCastException: Specified cast is not valid. Source Error: Stack Trace:
9
by: Microsoft News Server | last post by:
Hi, I am currently having a problem with random, intermittent lock ups in my ASP.net application on our production server (99% CPU usage by 3 threads, indefinately). I currently use IIS Debug...
2
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: ...
0
by: Alan Z. Scharf | last post by:
this question in datagrid group for several days with no repsonse. I'm hoping for an answer her because of greater activity in this group. No cross-posting intended. Thanks....
2
by: Kashiefah | last post by:
Hi, I keep on receiving this error when I click on the edit email link from the datagrid:Specified cast is not valid. Description: An unhandled exception occurred during the execution of the...
3
prabunewindia
by: prabunewindia | last post by:
hi friends, i am doing a ASP.NET project that display the mails from the outlook. whatever in inbox, outbox, etc. when i am getting the mail from inbox, i got the first one(welcome mail from the...
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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...
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...
0
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...
0
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...

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.