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

ⅰ亾dé卋堺 提交于 2020-01-06 06:32:58

问题


  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.


回答1:


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



来源:https://stackoverflow.com/questions/52057747/upload-document-in-online-sharepoint-site-collection-document-library-from-anoth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!