Balaji Radhakrishnan
Balaji Radhakrishnan

Reputation: 1050

Onedrive api how to attach files rather than downloading?

I followed the interactive live sdk and added it into my HTML page.

Also, I have successfully added the callback.html page where I am successfully getting the file picker dialog box. Once I select file from the file dialog box it's getting downloaded which I understand because of WL.download function.

But all I want is to attach the files rather than downloading it. how to change the javascript in interactive live sdk

Any suggestions?

Upvotes: 0

Views: 196

Answers (2)

Toan-Nguyen
Toan-Nguyen

Reputation: 321

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). 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.

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));
        }
    );
}

Upvotes: 1

Toan-Nguyen
Toan-Nguyen

Reputation: 321

In the ISDK (http://isdk.dev.live.com), you'll want to try using the "Using the save to OneDrive picker". You'll notice that WL.fileDialog is set to ({ mode: 'save' }) and the WL.upload function is called. I hope that helps.

Upvotes: 0

Related Questions