PC Review


Reply
Thread Tools Rate Thread

typemismatch by reading user property

 
 
Hahn, Thomas
Guest
Posts: n/a
 
      10th Jul 2008
Hallo NG,

I have an VB.NET application that open an email and read some user
properties. By reading one of the user property I get the exception
"HERSULT:0x80020005 (DISP_E-TYPEMISMATCH)". In my developer and test area
(that is an vm-system) my application works realy fine. All my user
properties will reading by my application. Both systems are the same
configuration (Win2003 server with sp2 and .Net framework 2)

Can anyone explain me the error message?

many thanks ,
Thomas


 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      10th Jul 2008
Hard to tell from that exception other than the obvious, that there was a
type mismatch in the call.

Does that UserProperty actually exist in the item being read on that target
system?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Hahn, Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hallo NG,
>
> I have an VB.NET application that open an email and read some user
> properties. By reading one of the user property I get the exception
> "HERSULT:0x80020005 (DISP_E-TYPEMISMATCH)". In my developer and test area
> (that is an vm-system) my application works realy fine. All my user
> properties will reading by my application. Both systems are the same
> configuration (Win2003 server with sp2 and .Net framework 2)
>
> Can anyone explain me the error message?
>
> many thanks ,
> Thomas
>


 
Reply With Quote
 
Hahn, Thomas
Guest
Posts: n/a
 
      10th Jul 2008
Yes the Property exist and can read with an vb6 application.

thomas


"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Hard to tell from that exception other than the obvious, that there was a
> type mismatch in the call.
>
> Does that UserProperty actually exist in the item being read on that
> target system?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hallo NG,
>>
>> I have an VB.NET application that open an email and read some user
>> properties. By reading one of the user property I get the exception
>> "HERSULT:0x80020005 (DISP_E-TYPEMISMATCH)". In my developer and test area
>> (that is an vm-system) my application works realy fine. All my user
>> properties will reading by my application. Both systems are the same
>> configuration (Win2003 server with sp2 and .Net framework 2)
>>
>> Can anyone explain me the error message?
>>
>> many thanks ,
>> Thomas
>>

>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      11th Jul 2008
What is the relevant snippet of your VB.Net code?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Hahn, Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes the Property exist and can read with an vb6 application.
>
> thomas
>
>
> "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
>> Hard to tell from that exception other than the obvious, that there was a
>> type mismatch in the call.
>>
>> Does that UserProperty actually exist in the item being read on that
>> target system?
>>
>> --
>> Ken Slovak
>> [MVP - Outlook]
>> http://www.slovaktech.com
>> Author: Professional Programming Outlook 2007.
>> Reminder Manager, Extended Reminders, Attachment Options.
>> http://www.slovaktech.com/products.htm
>>
>>
>> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hallo NG,
>>>
>>> I have an VB.NET application that open an email and read some user
>>> properties. By reading one of the user property I get the exception
>>> "HERSULT:0x80020005 (DISP_E-TYPEMISMATCH)". In my developer and test
>>> area (that is an vm-system) my application works realy fine. All my user
>>> properties will reading by my application. Both systems are the same
>>> configuration (Win2003 server with sp2 and .Net framework 2)
>>>
>>> Can anyone explain me the error message?
>>>
>>> many thanks ,
>>> Thomas
>>>

>>

>
>



 
Reply With Quote
 
Hahn, Thomas
Guest
Posts: n/a
 
      11th Jul 2008
The property is reading by a function.
The inputparameter for the function is the name of the user property.

------- my function -------------

Private Function CheckOLUserProp(ByVal tUserPropName As String, ByVal
fReturnException As Boolean) As Outlook.UserProperty
Try
If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then
Return mhMailItem.UserProperties.Find(tUserPropName)
Else
If fReturnException Then Throw New Exception
End If

Catch ex As Exception
If fReturnException Then
Throw New Exception("Feld '" & tUserPropName & "' konnte in Mail
nicht ermittelt werden")
Else
Return Nothing
End If
End Try
End Function
--------------------------------

"Dmitry Streblechenko" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> What is the relevant snippet of your VB.Net code?
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Yes the Property exist and can read with an vb6 application.
>>
>> thomas
>>
>>
>> "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im
>> Newsbeitrag news:(E-Mail Removed)...
>>> Hard to tell from that exception other than the obvious, that there was
>>> a type mismatch in the call.
>>>
>>> Does that UserProperty actually exist in the item being read on that
>>> target system?
>>>
>>> --
>>> Ken Slovak
>>> [MVP - Outlook]
>>> http://www.slovaktech.com
>>> Author: Professional Programming Outlook 2007.
>>> Reminder Manager, Extended Reminders, Attachment Options.
>>> http://www.slovaktech.com/products.htm
>>>
>>>
>>> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hallo NG,
>>>>
>>>> I have an VB.NET application that open an email and read some user
>>>> properties. By reading one of the user property I get the exception
>>>> "HERSULT:0x80020005 (DISP_E-TYPEMISMATCH)". In my developer and test
>>>> area (that is an vm-system) my application works realy fine. All my
>>>> user properties will reading by my application. Both systems are the
>>>> same configuration (Win2003 server with sp2 and .Net framework 2)
>>>>
>>>> Can anyone explain me the error message?
>>>>
>>>> many thanks ,
>>>> Thomas
>>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      11th Jul 2008
Which line is firing the exception?

Does it work any better if you supply True for the optional Custom argument
to UserProperties.Find()?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Hahn, Thomas" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The property is reading by a function.
> The inputparameter for the function is the name of the user property.
>
> ------- my function -------------
>
> Private Function CheckOLUserProp(ByVal tUserPropName As String, ByVal
> fReturnException As Boolean) As Outlook.UserProperty
> Try
> If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then
> Return mhMailItem.UserProperties.Find(tUserPropName)
> Else
> If fReturnException Then Throw New Exception
> End If
>
> Catch ex As Exception
> If fReturnException Then
> Throw New Exception("Feld '" & tUserPropName & "' konnte in Mail
> nicht ermittelt werden")
> Else
> Return Nothing
> End If
> End Try
> End Function
> --------------------------------


 
Reply With Quote
 
Hahn, Thomas
Guest
Posts: n/a
 
      12th Jul 2008
The exception is fired by trying to find my property

If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then

Sorry
what do you mean with "true for the optional Custom argument to
UserProperties.Find()"?

Thomas

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Which line is firing the exception?
>
> Does it work any better if you supply True for the optional Custom
> argument to UserProperties.Find()?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> The property is reading by a function.
>> The inputparameter for the function is the name of the user property.
>>
>> ------- my function -------------
>>
>> Private Function CheckOLUserProp(ByVal tUserPropName As String, ByVal
>> fReturnException As Boolean) As Outlook.UserProperty
>> Try
>> If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then
>> Return mhMailItem.UserProperties.Find(tUserPropName)
>> Else
>> If fReturnException Then Throw New Exception
>> End If
>>
>> Catch ex As Exception
>> If fReturnException Then
>> Throw New Exception("Feld '" & tUserPropName & "' konnte in Mail
>> nicht ermittelt werden")
>> Else
>> Return Nothing
>> End If
>> End Try
>> End Function
>> --------------------------------

>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      14th Jul 2008
If mhMailItem.UserProperties.Find(tUserPropName, True) IsNot Nothing
Then

That's what I meant by the optional Custom property. It's listed in the
Object Browser for UserProperties.Find().

I'd also start by verifying each object instead of using dot operators there
to help localize the problem. For example instead of:

If mhMailItem.UserProperties.Find(tUserPropName, True) IsNot Nothing
Then

use something like this:

If (mhMailItem IsNot Nothing) Then
Dim colProps As Outlook.UserProperties = mhMailItem
If (colProps IsNot Nothing) Then
' now use colProps with the Find method

That way you can tell where things are failing exactly.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Hahn, Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The exception is fired by trying to find my property
>
> If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then
>
> Sorry
> what do you mean with "true for the optional Custom argument to
> UserProperties.Find()"?
>
> Thomas


 
Reply With Quote
 
Hahn, Thomas
Guest
Posts: n/a
 
      23rd Jul 2008
I have changed my application, but the error is already exist.

I test the mailitem with a old testprogramm (create in vb 6). It show me
some information about the selected mailobject. If I checked the mailobject
on my client I get the value 'WAHR' for the userproperty. On the server I
get for the same property the value 'true'

Both systems have german as system language, but on the server I get an
TRUE. WHY?
Is that the reason of my error?

Thomas

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> If mhMailItem.UserProperties.Find(tUserPropName, True) IsNot Nothing
> Then
>
> That's what I meant by the optional Custom property. It's listed in the
> Object Browser for UserProperties.Find().
>
> I'd also start by verifying each object instead of using dot operators
> there to help localize the problem. For example instead of:
>
> If mhMailItem.UserProperties.Find(tUserPropName, True) IsNot Nothing
> Then
>
> use something like this:
>
> If (mhMailItem IsNot Nothing) Then
> Dim colProps As Outlook.UserProperties = mhMailItem
> If (colProps IsNot Nothing) Then
> ' now use colProps with the Find method
>
> That way you can tell where things are failing exactly.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Hahn, Thomas" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> The exception is fired by trying to find my property
>>
>> If mhMailItem.UserProperties.Find(tUserPropName) IsNot Nothing Then
>>
>> Sorry
>> what do you mean with "true for the optional Custom argument to
>> UserProperties.Find()"?
>>
>> Thomas

>





 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      23rd Jul 2008
Is this a string property or a boolean property? Normally for a boolean you
are checking the value for true or false and that's language independent (or
should be).

You should check to see exactly how you are retrieving the property value in
both versions and see if perhaps you are using a .ToString() somewhere or
something like that which is testing for a string value rather than the int
based boolean true or false.

At worst you could just check for both "true" and "wahr".

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Hahn, Thomas" <(E-Mail Removed)> wrote in message
news:%23RlKA$(E-Mail Removed)...
>I have changed my application, but the error is already exist.
>
> I test the mailitem with a old testprogramm (create in vb 6). It show me
> some information about the selected mailobject. If I checked the
> mailobject
> on my client I get the value 'WAHR' for the userproperty. On the server I
> get for the same property the value 'true'
>
> Both systems have german as system language, but on the server I get an
> TRUE. WHY?
> Is that the reason of my error?
>
> Thomas


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Typemismatch when duplicating graph PBradac Microsoft Excel Programming 6 3rd Feb 2010 02:58 PM
TypeMismatch - TreeView Control David C. Holley Microsoft Access VBA Modules 1 13th Nov 2005 03:51 AM
annoying error (TypeMismatch) =?Utf-8?B?U2FzYW4=?= Microsoft Access VBA Modules 2 22nd Mar 2005 11:49 PM
Reading Object Property Hon Yuen, Ng Microsoft VB .NET 1 3rd Mar 2005 10:42 AM
Reading File Property? =?Utf-8?B?S3JpWg==?= Microsoft Dot NET 4 17th Feb 2004 03:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:11 PM.