As new datatype is introduced for Immunization, I am not able to convert/cast the old Immuniations to new datatype or viceversa. Below code stopped working for me:
// create and add the filter
HealthRecordFilter filter = new HealthRecordFilter();
filter.TypeIds.Add(new Guid(ImmunizationGUID));
filter.TypeIds.Add(Microsoft.Health.ItemTypes.Immunization.TypeId);
filter.View.Sections = HealthRecordItemSections.All;
searcher.Filters.Add(filter);
HealthRecordItemCollection hvItems = searcher.GetMatchingItems()[0];
foreach (HealthRecordItem item in hvItems)
{
Microsoft.Health.ItemTypes.Immunization hvImm = item as Microsoft.Health.ItemTypes.Immunization;
}
Here, for the new Immunization datatypes, it is working fine, but it turns out to be NULL for the old ones. Any way to covert it?