By default, when a query is made to HealthVault, it returns all instances of a specific type. If you wish to filter to a subset of those instances, you can specify some properties in the HealthRecordFilter class. For example, you can set the CreatedApplication property to filter on the application that created the health record item.

The filter properties, however, only works for properties that are shared across all data types. If you want to filter based on properties that are data-type-specific, you can do that by setting the XPath property to an appropriate XPath query.

Creating that query is a bit inconvenient – perhaps a lot inconvenient – so I wrote a little utility that you can use to easily create an xpath query.

You can find the code here.

Make a copy of the HelloWorld sample, put the two files into it, and run the sample.