简体   繁体   中英

Upload document in online SharePoint site collection document library from another application outside SharePoint

  1. I have developed a SharePoint App that is running on Online SharePoint 2016 site Collection.

  2. Have another Software Application with Rest API that is running on my another Online server. More this app is purely developed using HTML,Javascript/JQuery. no server side scripting.

  3. More SharePoint App strongly integrated with my Software Application (using Ajax calls for data fetching).

Now the issue is, i want to upload files into SharePoint from Software Application.

Note: Anonymous access is not available in Office 365 Online account as per my R&D.

Please help and Thanks in Advance.

You can follow the steps below to upload a file by using the REST API and jQuery:

  1. Convert the local file to an array buffer by using the FileReader API, which requires HTML5 support. The jQuery(document).ready function check FileReader API support in the browser.
  2. Add the file to the Shared Documents folder by using the Add method on the folder's file collection. The array buffer is passed in the body of the POST request.
  3. Get the list item that correspond to uploaded file by using the ListItemAllFields property of uploaded file.
  4. Change the display name and title of the list item by using a MERGE request.

These examples use the getfolderbyserverrelativeurl endpoint to reach the file collection. You can also use a list endpoint (example: …/_api/web/lists/getbytitle('')/rootfolder/files/add).

For more information, please review the following link: Upload a file by using the REST API and jQuery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM