Tuesday, April 10, 2012 6:11 PM
Hi, I would like to know how do i update an existing entry in HealthVault using xml. I have
Weight objType = (Weight)personObj.SelectedRecord.GetItem(ItemID, HealthRecordItemSections.Xml);
Rather than setting values like
objType .Value.Kilograms = 50;
i would like to pass following xml to it
How can i set the xml to Weight object and update it??
Tuesday, April 10, 2012 7:44 PM
Someone was talking about this in a n earlier thread.
Wednesday, April 11, 2012 2:20 PM
I don't understand the thread you pointed. My code
Weight objType = (Weight)personObj.SelectedRecord.GetItem(ItemID, HealthRecordItemSections.Xml); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlString); HealthRecordItem typeId = new HealthRecordItem(objType, doc);
It is giving me error saying not a valid id? I know i am doing some thing wrong with HealthRecordItem, don't know how to set it?
Monday, April 16, 2012 11:40 AM
You need the UID for that record type....
string xml = "<weight><when><date><y>2011</y><m>3</m><d>15</d></date></when><value><kg>50</kg></value></weight>"; XPathNavigator nav = XElement.Parse(xml).CreateNavigator(); // this may not be required, only if your using a page base class base.PersonInfo = WebApplicationUtilities.LoadPersonInfoFromCookie(Context); HealthRecordItem hri = new HealthRecordItem(Guid.Parse("3d34d87e-7fc1-4153-800f-f56592cb0d17"), nav); PersonInfo.SelectedRecord.NewItem(hri);
You could not hard type the UID and use:
However if you using generics, you'll want to use the literal, I get them all from here:
I've supplied a full code list and details on my original thread.