hey
i created a custom type and register it in healthvault, i followed the code in msdn of CustomHealthTypeWrapper. adding a new item to HV is working, but when i get that item from HV this error appeared:
Unable to cast object of type 'Microsoft.Health.ItemTypes.ApplicationSpecific' to type 'CustomHealthTypeWrapper'.
Here is the code i used to get an item:
Dim TYPE As Guid = New Guid(CustomHealthTypeWrapper.ApplicationCustomTypeID)
Dim searcher As HealthRecordSearcher = Me.PersonInfo.SelectedRecord.CreateSearcher()
Dim filter As HealthRecordFilter = New HealthRecordFilter()
filter.TypeIds.Add(TYPE)
filter.XPath = Incident.XPathFilterForQuery
searcher.Filters.Add(filter)
Dim objincident As New Incident
Dim items As HealthRecordItemCollection = searcher.GetMatchingItems(0)
For Each item As HealthRecordItem In items
Dim obj As New CustomHealthTypeWrapper
obj = DirectCast(item, CustomHealthTypeWrapper)
Next
the error appeared when trying to cast from item to CustomHealthTypeWrapper
thanks