How do I access the type-specific data in HealthRecordItemCollection?
-
Friday, December 14, 2012 2:13 PM
Hi,
I'm having problems working with the HealthRecordItemCollection class.
I've used a HealthRecordSearcher to find all the Message ItemTypes in an account using an offline Windows Forms Application.
The results are returned in a HealthRecordItemCollection which I gather seems to be the usual way to return search results. As I know that everything in the collection is a Message itemtype (because I specified that in the healthRecordFilter), how do I then access all of the type specific data that is in each message in the collection? For example, I want to read each From, Subject, Summary, Attachment value that is in each item in the collection.
I'm still new to HealthVault so apologies if I'm asking a simple question!
All Replies
-
Friday, December 14, 2012 5:41 PM
Hi,
Can you try something like this:
ThanksHealthRecordFilter filter = new HealthRecordFilter(Message.TypeId); searcher.Filters.Add(filter);
HealthRecordItemCollection items = searcher.GetMatchingItems()[0];
foreach (Message msg in items) { // retrieve each message here as msg.<whatever you are interested in> }
Santhosh
- Edited by Santhosh Pillai Friday, December 14, 2012 5:42 PM
- Marked As Answer by GizzerGis Monday, December 17, 2012 12:50 PM
-
Monday, December 17, 2012 12:52 PMThanks for your help - it worked perfectly!

