none
Office 365 - Issues with data URI upload using the OneDrive File Picker JavaScript SDK v7.2 RRS feed

  • Question

  • Hi,

    I'm currently trying to upload a file with the OneDrive File Picker JavaScript SDK v7.2 to a OneDrive for Business account. I followed the instructions provided at https://docs.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/save-file.

    The implemented solution works when I use a <input> control to select the file in combination with the sourceInputElementID property of configuration object.

    However when the try to use a data URI as a sourceURI the upload fails with the error message "Upload error [OneDriveSDK Error] errorType: unsupportedFeature, message: URL upload not supported for OneDrive business".

    Quote documentation for the sourceURI property reads as follows:

    "An http, https, or data URI for the file to be uploaded. OneDrive for Business and SharePoint only supports data URI values."

    Am I missing something? Is the data URI upload supported for the File Picker?

    Here is the configuration object:

    var odOptions = {
    clientId: "[VALID-CLIENT-ID]",
    action: "save",
    sourceInputElementId: "",
    sourceUri: "data:text/html,lorem ipsum",
    fileName: "test.txt",
    openInNewWindow: true,
    advanced: {},
    success: function(files) { console.log("Upload succeeded."); },
    progress: function(p) { console.log("Upload progress: " + p); },
    cancel: function() { console.log("Upload canceled."); },
    error: function(e) { console.log("Upload error " + e); }
    }
    OneDrive.save(odOptions);


    Thursday, December 7, 2017 7:54 AM