question

jamilhaddadin-8221 avatar image
0 Votes"
jamilhaddadin-8221 asked ·

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
office-vba-dev
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You have posted in the Office for Mac category.

0 Votes 0 ·
jamilhaddadin-8221 avatar image
0 Votes"
jamilhaddadin-8221 answered ·

Thank you John, I have fixed the category

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Viorel-1 avatar image
0 Votes"
Viorel-1 answered ·

Did you try to read this property, and, if it returns some value, to determine its type? Maybe it is not Long.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

jamilhaddadin-8221 avatar image
0 Votes"
jamilhaddadin-8221 answered ·

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


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.