locked
Uploading Files RRS feed

  • Question

  • I am trying to upload files to my HealthVault test account.  The file shows up in HealthVault but when I try to download the file HealthVault tells me it could not complete the requested action.  Below is my sample code.  What am I doing wrong?

     

    Thanks,

    Ashley

     

    'Add a new File

    Dim FInfo As FileInfo

    Dim F As Microsoft.Health.ItemTypes.File

    Dim S1 As Integer

     

    FInfo = New FileInfo("C:\Angela.pdf")

    S1 = FInfo.Length

     

    F = New Microsoft.Health.ItemTypes.File()

    F.Name = "C:\Angela.pdf"

    F.Size = S1

    F.ContentType = New CodableValue("application/pdf")

    accessor.NewItem(F)

    Wednesday, February 6, 2008 8:10 PM

Answers

  • Ashley,

     

    When I looked at your code, I didn't notice that you weren't uploading the content. I wrote a blog post that has some code that works for me - let me know if you need additional help.

    Wednesday, February 13, 2008 5:52 PM

All replies

  • Ashley,

     

    If you can see the file in HealthVault, it's likely that your upload code is correct.

     

    Can you also share the code you're using to retrieve the file?

     

     

     

    Tuesday, February 12, 2008 4:15 PM
  •  

    Eric,

     

    Here is what I was trying to do.  Through code I uploaded a file to health vault.  Next I then went to the health vault web site and logged in.  Then I navigated to the documents section.  Here I can see the files that I uploaded but when I try to view then it does not work.  Given this I am trying to retrieve the file programmatically.  Below is the code that I am using but I do not know what I need to do to actually write the file to disk.  If you look at the line HVF = item I can see that I have the uploaded file so using this object (HVF) how do I same this file to disk? 

     

    Thanks,

    Ashley

     

    Dim searcher1 As HealthRecordSearcher = accessor.CreateSearcher()

    Dim filter1 As New HealthRecordFilter(Microsoft.Health.ItemTypes.File.TypeId)

    Dim HVF As Microsoft.Health.ItemTypes.File

     

    searcher1.Filters.Add(filter1)

     

    Dim items1 As HealthRecordItemCollection = searcher1.GetMatchingItems()(0)

     

    If IsNothing(items1) = False AndAlso items1.Count > 0 Then

    Dim FileXList As New List(Of Microsoft.Health.ItemTypes.File)()

    For Each item As HealthRecordItem In items1

    HVF = item

    FileXList.Add(DirectCast(item, Microsoft.Health.ItemTypes.File))

    Next

    ' Display the offline records

    'PopulateHeightTable(heightList)

    Else

    End If

    Tuesday, February 12, 2008 6:23 PM
  • One thing I forgot to mention is that I am trying to upload pdf files.

    Tuesday, February 12, 2008 6:30 PM
  • Ashley,

     

    When I looked at your code, I didn't notice that you weren't uploading the content. I wrote a blog post that has some code that works for me - let me know if you need additional help.

    Wednesday, February 13, 2008 5:52 PM
  • hi...

    I need a help on uploading ccd and getting the status of the ccd file.

    The thing is that I added ccd in healthvault and want to downlaod the CCD by the healthvault searcher class. and i want to show the ccd information from my application. So how can i get the specific object for CCD like Allergy or Medication?
    Tuesday, June 9, 2009 6:12 AM