Thank you John, I have fixed the category
Unable to use PropertyAccessor.SetProperty for "Total Work" property (Type Mismatch)
This question is about VBA code that is trying to run on outlook M365 client on windows 10
I am trying to set the "Total Work" property for mailItem but it is always throwing "Type Mismatch" here is the code (olkTask is a mailItem object)
"Total Work" Property scheme is "http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81110003"
Set myPropSetting = olkTask.PropertyAccessor
Dim x As Long
x = 2
myPropSetting.SetProperty "http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81110003", x
olkTask.Save
3 answers
Sort by: Most helpful
-
-
Viorel 112.5K Reputation points
2021-03-08T08:42:49.94+00:00 Did you try to read this property, and, if it returns some value, to determine its type? Maybe it is not Long.
-
jamil haddadin 6 Reputation points
2021-03-08T09:48:22.893+00:00 you are right! it is "Variant/Long", so when I changed it to Variant it works!
Dim x As Variant
x = 2
If iTotalWork = 0 And iActualWork = 0 Then
myPropSetting.SetProperty "http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81110003", x
olkTask.Save
End If