OneDrive / samples

Contains samples, scenarios, and guidance for integrating with OneDrive and SharePoint drives, drive items, and files.
MIT License
49 stars 48 forks source link

Issue with File Download Redirect in TypeScript React Example #51

Closed nickst97 closed 6 months ago

nickst97 commented 10 months ago

Issue Description: I have followed the example code provided in the file-picking/typescript-react repository for file picking. The code is identical to the example given.

The problem I am facing happens after selecting a file (in my case, a .xlsx file). That file gets selected and loaded without any issues, and the file's thumbnail also appears as expected. However, when I click the download button to download the file, it redirects me to my OneDrive folder and then to the online version of the file.

Is this the intended behaviour of the file download functionality in this example? There may be an issue with the download process.

Steps to Reproduce:

  1. Clone the file-picking/typescript-react repository.
  2. Follow the example code for file picking.
  3. Select a .xlsx file.
  4. Click the download button.

Expected Behavior: Clicking the download button should initiate the download of the selected file directly without any unexpected redirects.

Actual Behavior: Clicking the download button redirects me to my OneDrive folder and then opens the online version of the file.

Please let me know if there's any additional information needed to address this issue.

patrick-rodgers commented 10 months ago

The samples are just meant to show various possibilities for working with the picker. In this case we grab the webDavUrl off the item and use that as a shortcut for downloads. In this case the webDavUrl for MS owned office file types appears to redirect to the online experience. You could make additional request to get the download url and other item information to make whatever url you need.