Method Community

 

Downloading Document

Last post 11-27-2012 2:57 PM by Matt. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-19-2012 4:23 PM

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Downloading Document

    How do you download a document file using the API?


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


  • 11-21-2012 9:17 AM In reply to

    Re: Downloading Document

    Answer


    Hi Matt,

    For any file field....two columns get added to the table. The first column is the name of the field. Internally we store the data as varbinary. The second column is fieldnameFileName, which is the name of the file.

    When you retrieve the data, it is a bytearray.

    So a simple example would be as follows:

    When you retrieve the file name, you need to append the filename to the location where you are saving the file (assuming you want a local copy)

    Then  you can use the .Net File.WriteAllBytes(path, bytearray) function....using the location + filename mentioned above, and the bytearray of data as parameters to write the file locally

    Dave

  • 11-27-2012 2:57 PM In reply to

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Re: Downloading Document

    Thank You Dave!


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


Page 1 of 1 (3 items)