
Personally, I don’t like using Object, especially in an API. You don’t get type safety, it’s hard to know what classes are supported, and it’s easy for code to break in future releases. Unfortunately, Object is the type for property values. So I’ll be taking a look at Connection.PropertyManager.GetPropertyValue() and describing what you can expect for the return types.
The API documentation for PropertyDataType lists what the .NET classes are for the various Vault property types.
| PropertyDataType | Object type |
| Bool | System.Boolean |
| DateTime | System.DateTime |
| Image | ThumbnailInfo |
| ImageInfo | ImageInfo |
| Numeric | System.Double |
| Object | System.Object |
| String | System.String |
Unfortunately this table is not 100% correct. There are various cases and outright defects you need to know.
First, let me explain the difference between Image and ImageInfo. ImageInfo is for things like the Category Glyph properties. These are graphics provided client-side. The Image type is for thumbnails stored server-side.
Picklists are one of the special cases you have to worry about. If the property requires picking from a list, the value is of type PropertyDefinition.EnumeratedValue, which has both a display value (String) and a “true” value (Object). The true value will have a data type matching the table above. You can use the HasListValues property on PropertyDefintion to tell if a property is a picklist or not.
The Object is mainly there for if you want to add your own client-side property definitions. EntityType is the only out-of-the-box property that uses Object. In that case, the object type is EntityClass.
In running my own test, I found that the system properties FileSize and VersionNumber did not behave as expected. These have int values, not Doubles. If you try a direct cast to Double, it will fail.
So here is my summary of special cases…
| Property System Name | Object type |
| EntityType | EntityClass |
| FileSize | int |
| VersionNumber | int |
| <any property with a value list> | PropertyDefinition.EnumeratedValue |

Leave a Reply