0

I'm trying to pull a JSON file from sharepoint and importing it into Oracle. When I put the JSON file in my C Drive and use this file path C:\json\jsonfile.json it loads perfectly. When I switch to my Sharepoint path it does not upload.

Here is the script I am using. Any ideas on how to get it to pull from sharepoint? Works perfectly when the file is on my c drive but not when I use my sharepoint file path.

String jsonFileContent = File.ReadAllText(@"\\sharepoint.site.gov\sites\pagename\folder\jsonfilen.json");
    JavaScriptSerializer js = new JavaScriptSerializer();
    js.MaxJsonLength = Int32.MaxValue;
    List<Data> datas = js.Deserialize<List<Data>>(jsonFileContent);
    foreach(Data data in datas)

Here is the error message that I get:

"A Device attached to the system is not functioning."

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, >Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at System.IO.File.ReadAllText(String path) at ScriptMain.CreateNewOutputRows() at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers, OutputNameMap OutputMap) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)

3
  • Would it make more sense to use the SharePoint API to retrieve the file? Commented Jul 19, 2018 at 19:10
  • I'm creating an SSIS package that will load multiple files. I have csv, excel, and this JSON file all coming from a sharepoint site Commented Jul 19, 2018 at 19:14
  • Is this related? stackoverflow.com/a/45553754/3608792 Commented Jul 19, 2018 at 19:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.