简体   繁体   English

OneDrive API如何附加文件而不是下载?

[英]Onedrive api how to attach files rather than downloading?

I followed the interactive live sdk and added it into my HTML page. 我遵循了交互式实时SDK ,并将其添加到我的HTML页面中。

Also, I have successfully added the callback.html page where I am successfully getting the file picker dialog box. 另外,我已经成功添加了callback.html页面,在此页面中我成功获取了文件选择器对话框。 Once I select file from the file dialog box it's getting downloaded which I understand because of WL.download function. 从文件对话框中选择文件后,由于WL.download功能,该文件将被下载。

But all I want is to attach the files rather than downloading it. 但是,我想要的只是附加文件而不是下载文件。 how to change the javascript in interactive live sdk 如何在交互式实时SDK中更改javascript

Any suggestions? 有什么建议么?

Sorry about that. 对于那个很抱歉。 You can either use the "source" or the "link" to accomplish this. 您可以使用“源”或“链接”来完成此操作。 On the ISDK for "Using the open from OneDrive picker", change the code following code snippet (I used "file.link" below). 在“使用OneDrive选择器中的打开文件”的ISDK上,按照代码段更改代码(我在下面使用了“ file.link”)。 The Output box should give you some idea on what the link would be if you include it in your app. 如果将链接包含在应用程序中,则“输出”框应使您对链接的含义有所了解。 You'll, of course, will want to remove the "WL.download" function so that it doesn't download the file and add the file.link or file.source somewhere into your code instead of logging it like the ISDK does. 当然,您将需要删除“ WL.download”功能,以便它不会下载文件并将file.link或file.source添加到代码中的某个位置,而不是像ISDK那样将其记录下来。

 function openFromSkyDrive() { WL.fileDialog({ mode: 'open', select: 'single' }).then( function(response) { log("The following file is being downloaded:"); log(""); var files = response.data.files; for (var i = 0; i < files.length; i++) { var file = files[i]; log(file.link); WL.download({ "path": file.id + "/content" }); } }, function(errorResponse) { log("WL.fileDialog errorResponse = " + JSON.stringify(errorResponse)); } ); } 

In the ISDK ( http://isdk.dev.live.com ), you'll want to try using the "Using the save to OneDrive picker". 在ISDK( http://isdk.dev.live.com )中,您将要尝试使用“使用保存到OneDrive选择器”。 You'll notice that WL.fileDialog is set to ({ mode: 'save' }) and the WL.upload function is called. 您会注意到WL.fileDialog设置为({mode:'save'})并调用了WL.upload函数。 I hope that helps. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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