Monday, November 12, 2012 8:38 AM
I compile and run "ClientSamples" provided by HealthVault SDK("Program Files\Microsoft HealthVault\SDK\DotNet\ClientSamples") and upload weight data successfully. But when I want to upload blood pressure data through modifying code,the Visual Studio 2008 reminds me that the "Microsoft.Health.HealthServiceAccessDeniedException" occurs.
The code of uploading weight data:
Weight weight = new Weight();
weight.Value = new WeightValue(weightValue);
The code of uploading blood pressure data:
BloodPressure bloodPressure = new BloodPressure();
bloodPressure.Systolic = 120;
bloodPressure.Diastolic = 80;
bloodPressure.Pulse = 75;
bloodPressure.When = new HealthServiceDateTime();
_healthClientApplication = HealthClientApplication.Create(_applicationId, _masterApplicationId);
HealthClientAuthorizedConnection connection = HealthClientApplication.CreateAuthorizedConnection(PersonId);
HealthRecordAccessor accessor = new HealthRecordAccessor(connection, RecordId);
Why the exception occurs and how to solve it?
Monday, November 12, 2012 7:20 PM
The sample application only requests read/write access for Height and Weight measurements, Custom Data, and Fitness data types. This is why you get access denied when you try to write Blood Pressure value.
You can see the data types that the application requests when you provision the app.
- Marked As Answer by Kevin00000000 Tuesday, November 13, 2012 2:46 AM
Tuesday, November 13, 2012 2:46 AM
Because I use the predefined MaseterApplicationId in the Sample,and it has only access for Height and Weight measurements, Custom Data, and Fitness data types.Once I register a new MaseterApplicationId and set its access for blood pressure,upload successfully!