PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
typemismatch by reading user property
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
typemismatch by reading user property
![]() |
typemismatch by reading user property |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 >> > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 >>> >> > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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 >>>> >>> >> >> > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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 > -------------------------------- |
|
|
|
#7 |
|
Guest
Posts: n/a
|
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 >> -------------------------------- > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#9 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#10 |
|
Guest
Posts: n/a
|
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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

