PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins typemismatch by reading user property

Reply

typemismatch by reading user property

 
Thread Tools Rate Thread
Old 10-07-2008, 08:31 AM   #1
Hahn, Thomas
Guest
 
Posts: n/a
Default typemismatch by reading user property


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
Old 10-07-2008, 02:11 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <nix@mail.de> wrote in message
news:OE7kr7l4IHA.4260@TK2MSFTNGP06.phx.gbl...
> 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
Old 10-07-2008, 06:05 PM   #3
Hahn, Thomas
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

Yes the Property exist and can read with an vb6 application.

thomas


"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> schrieb im Newsbeitrag
news:ucWYa6o4IHA.3804@TK2MSFTNGP03.phx.gbl...
> 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" <nix@mail.de> wrote in message
> news:OE7kr7l4IHA.4260@TK2MSFTNGP06.phx.gbl...
>> 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
Old 11-07-2008, 01:24 AM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <nix@mail.de> wrote in message
news:uwPox8q4IHA.3480@TK2MSFTNGP03.phx.gbl...
> Yes the Property exist and can read with an vb6 application.
>
> thomas
>
>
> "Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> schrieb im Newsbeitrag
> news:ucWYa6o4IHA.3804@TK2MSFTNGP03.phx.gbl...
>> 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" <nix@mail.de> wrote in message
>> news:OE7kr7l4IHA.4260@TK2MSFTNGP06.phx.gbl...
>>> 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
Old 11-07-2008, 06:56 AM   #5
Hahn, Thomas
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <dmitry@dimastr.com> schrieb im Newsbeitrag
news:OTH0Nyu4IHA.4856@TK2MSFTNGP02.phx.gbl...
> 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" <nix@mail.de> wrote in message
> news:uwPox8q4IHA.3480@TK2MSFTNGP03.phx.gbl...
>> Yes the Property exist and can read with an vb6 application.
>>
>> thomas
>>
>>
>> "Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> schrieb im
>> Newsbeitrag news:ucWYa6o4IHA.3804@TK2MSFTNGP03.phx.gbl...
>>> 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" <nix@mail.de> wrote in message
>>> news:OE7kr7l4IHA.4260@TK2MSFTNGP06.phx.gbl...
>>>> 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
Old 11-07-2008, 01:57 PM   #6
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <nix@mail.de> wrote in message
news:%23BZegrx4IHA.4272@TK2MSFTNGP03.phx.gbl...
> 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
Old 12-07-2008, 05:22 AM   #7
Hahn, Thomas
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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]" <kenslovak@mvps.org> schrieb im Newsbeitrag
news:uDptib14IHA.3828@TK2MSFTNGP02.phx.gbl...
> 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" <nix@mail.de> wrote in message
> news:%23BZegrx4IHA.4272@TK2MSFTNGP03.phx.gbl...
>> 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
Old 14-07-2008, 02:27 PM   #8
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <nix@mail.de> wrote in message
news:eqqXcb94IHA.2348@TK2MSFTNGP06.phx.gbl...
> 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
Old 23-07-2008, 07:45 AM   #9
Hahn, Thomas
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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]" <kenslovak@mvps.org> schrieb im Newsbeitrag
news:e2qtsYb5IHA.2260@TK2MSFTNGP03.phx.gbl...
> 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" <nix@mail.de> wrote in message
> news:eqqXcb94IHA.2348@TK2MSFTNGP06.phx.gbl...
>> 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
Old 23-07-2008, 02:52 PM   #10
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: typemismatch by reading user property

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" <nix@mail.de> wrote in message
news:%23RlKA$I7IHA.1420@TK2MSFTNGP06.phx.gbl...
>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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off