問題描述
從 ERP 保存到 OneDrive (Save to OneDrive from ERP)
我們希望將文檔保存到單個 OneDrive 文件夾中。
當前:用戶“Tim”在我們的 ERP 系統中從客戶“TomCompany”生成客戶概覽(上次訪問、收入等),它將自動保存在 FTP 文件夾中。他現在可以在他的 iPad 上使用 Good Reader 在客戶站點上查看此文件。
計劃:第一步:客戶概覽應直接保存到 OneDrive,而不是 FTP 文件夾。第二步:每個銷售人員都有自己的 OneDrive 帳戶,因此應將其與用戶參數等一起保存到自己的帳戶中(這在我們的 ERP‑API 中管理不是問題)。
問題是:是否可以從不同的系統(如 ERP)連接到 OneDrive。“帶有身份驗證的 SaveFileToOneDrive”
參考解法
方法 1:
You can 'connect' to OneDrive through the given API with JavaScript.
Here is an example: https://dev.onedrive.com/sdk/js‑v7/js‑picker‑save.htm . You can now add the 'Save to OneDrive' button on every page you need it.
If not noticed yet, some examples for the API: https://dev.onedrive.com/sample‑code.htm
Hope this helps you to solve your (for me still unknown) problem ;‑)
方法 2:
I implemented own windows live API because of I found some problems with standard live api. It is based on REST API so there is layer with objects (file, folder, etc...) and each object has some equipment (i.e. file has method for upload and download file). Second layer is for communication with server side and object layer send requests into second layer which send it into server. Server sends response and second layer return this response into object layer. I implemented onedrive function mainly because of I developed application which uploads some files into onedrive.
So it is very simple to use it. I describe it on webpage https://wlivefw.codeplex.com/ You can sign as user which onedrive want to use by connection object. Then you will need folder id where you want to create new file. Then you create file object with parent_id set to folder id, name (is required) and description (optional). And now you call File.Create(file object which you created, Stream object ‑ data of origin file, OverWriteOption ‑ if you want to overwrite file if exists or not or create with new name, and progress handler ‑ delegate to method which you want to invoke when progress changed).
File uploading is implemented by BITS protocol, so you can upload file greater than 60MB. File is uploaded by fragment so if fragment uploading fails you can very easy send this fragment again ‑ in exception when uploading fails is delegate to continue method which continue upload from last successfull fragment.
I would like to improve this library so library is free to use as well as source code. Please if you will expand this library send me your changes and I will build new version, etc... Thank you and I hope it is usefull.