0

I am attempting to upload a text file to a SharePoint 2016 document library. The text file contains a single-line string that represents JSON data:

{"User": "JANE A DOE","AssignedTo": "JDOE","StatementDate": "12/25/2019","Total": 24.93,"Transactions": [{"TransactionDate": "12/15/2019","PostingDate": "12/18/2019","MerchantName": "APPLE","GL": "1234567","MCC": "1234","Amount": "14.97","SalesTax": "0","Company": "123","CostCenter": "12345","Attendees": false,"AttendeesInfo": [],"ExpenseType": "Business Travel","ExpenseCategory": "Single Day Meal/Incidental","BusinessPurpose": "test"}]}

This file is uploaded to the the a document library with the following structure: libraryName/folderName/fileName.

This is the URL I am pointing my REST call to: https://mySite/divisions/testing/_api/web/GetFolderByServerRelativeUrl('/divisions/testing/myDocLibrary/February2020')/Files/Add(url='JDOE_122519_fresh.txt',overwrite=true)

This call usually won't work for someone trying it for the first time or someone who hasn't use the page in several days. Reloading the page and trying again will successfully complete the call.

The error displayed in the console when this happens is:

XMLHttpRequest: Network Error 0x80030019, an error occurred during a seek operation.

How can I resolve this?

  • Where are you hosting this JavaScript? And when you say "won't work for someone" -- what does that mean: does it overwrite the wrong file, does it modify the posted JSON body, does the user get an error message, does their browser crash, do they get infected with covid-19? – willman Mar 23 at 17:05
  • @willman The JS is stored in this folder: mySite/divisions/testing/_catalogs/masterpage/Custom. I added the error message. Sorry about that. I thought it was in my draft. – cfoster5 Mar 23 at 17:25
  • When I was asking about the Host, I wasn't as much concerned about where the .js file was stored, as much as what container is it executing from? e.g. is it hosted on a html page on another webserver, or via script webpart on a classic page in the pages library on the same site, or a custom .net page in a different sharepoint site, or a python page hosted on a linux server, or the users execute in nodejs on their local machine? – willman Mar 23 at 17:48
  • @willman It is executing from a page that has a Content Editor linked to a HTML file with JavaScript references. – cfoster5 Mar 23 at 17:49
  • And that page is in the same, or different, site than the library that the file is being added to? – willman Mar 23 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.