angular-snippets-rest-sample icon indicating copy to clipboard operation
angular-snippets-rest-sample copied to clipboard

Download file request returns cross-origin error

Open DianeD opened this issue 10 years ago • 1 comments

The following request to download a file returns an XMLHttpRequest cross-origin error. GET me/drive/items/<file-id>/content

DianeD avatar Oct 06 '16 18:10 DianeD

Planning to add a workaround that uses the downloadUrl property of the file, per this guidance. Something like:

createFile()
    .then(function (response) {
        var req = {
            method: 'GET',
            url: response.data['@microsoft.graph.downloadUrl'],
            headers: {
                Authorization: undefined,
                SampleID: undefined
            }
        };
        deferred.resolve($http(req));
    })
    .catch(function (error) {
        deferred.reject({
            setupError: 'Unable to create a file to download or download the file.',
            response: error
    });
})

DianeD avatar Feb 24 '17 22:02 DianeD