none
IO.StreamReader from sharepoint RRS feed

  • Question

  • hello all,

    I use a streamreader on a csv file that is manually put in a set location in my local directory every morning,

     Dimsr AsNewIO.StreamReader("\\localserver\dump\DD01-Despatch.csv")

    I want to replace this code for it to read the file from sharepoint, so I tried this code and it failed drastically

    Dim sr AsNewIO.StreamReader("https://company.sharepoint.com/:x:/s/ITTeam/EdduvDWG2EZJty41YlzAqKEBiOae_GcCn1lps1jHnBCshA?e=ua21ox")

    I want the file to read from sharepoint so I can set a flow to pull the attachment from the email and save it there and there is no longer a need for anyone to manually drop files in a set location.

    any help is as always appreciated

    Monday, March 18, 2019 1:03 PM

Answers

  • i found a solution for this by having a static computer doing a one drive sync to the folder set in my sharepoint

    i then have my web app running the stream reader to the file in that location 

    thanks to Gtripodi your answer helped mr come to the solution of this

    • Marked as answer by Towle92 Tuesday, March 19, 2019 11:32 AM
    Tuesday, March 19, 2019 11:32 AM

All replies

  • Im sorry, "failed drastically" is not an exception I am familiar with.


    Live as if you were going to die today, learn as if you were going to live forever -Mahatma Gandhi

    Monday, March 18, 2019 1:15 PM
  • Illegal characters in path.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Illegal characters in path.

    Line 361:        Dim sr As New IO.StreamReader("https://companyname.sharepoint.com/:x:/s/ITTeam/EdduvDWG2EZJty41YlzAqKEBiOae_GcCn1lps1jHnBCshA?e=ua21ox")

    clarification on the error

    Monday, March 18, 2019 1:20 PM
  • I am uncertain why you're getting a web request exception out of a StreamReader.

    At any rate, you could probably use WebDav URI to the SP library, or map a net drive to the SP library and supply that path to the StreamReader


    Live as if you were going to die today, learn as if you were going to live forever -Mahatma Gandhi



    • Edited by Gtripodi Monday, March 18, 2019 1:33 PM
    Monday, March 18, 2019 1:31 PM
  • i found a solution for this by having a static computer doing a one drive sync to the folder set in my sharepoint

    i then have my web app running the stream reader to the file in that location 

    thanks to Gtripodi your answer helped mr come to the solution of this

    • Marked as answer by Towle92 Tuesday, March 19, 2019 11:32 AM
    Tuesday, March 19, 2019 11:32 AM