How to directly download images and .txt files from sharepoint directly via URL? (more context in the description).

Cabillo, Mark Joseph 5 Reputation points
2023-06-05T13:00:54.32+00:00

What I mean by this is that the "?download=1" trick does not work on image files and .txt files. On image files it just displays the image on browser. On .txt files, it shows nothing. It completely ignores the "?download=1" appended at the end of sharepoint URL. For comparison sake, files like .docx, .csv, and other office files works just fine.

I just want to download the files from sharepoint just by entering the URL in the browser for automation purposes. And its irritating that some filetypes just dont work.

I'm using google chrome as a browser for this.

OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
974 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,273 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 24,121 Reputation points Microsoft Vendor
    2023-06-07T08:42:26.91+00:00

    Hi @Cabillo, Mark Joseph ,

    It is common for images and text (.txt) files to be displayed in the browser instead of downloading when accessed through a URL. The "?download=1" trick may not work for these file types. One possible workaround is to add "&web=1" to the URL instead of "?download=1". This should force the file to download instead of being displayed in the browser.

    However, it is important to note that this workaround may not work in all cases and it may depend on the browser being used. Additionally, you may need to add the SharePoint URL to the list of trusted sites in your browser settings before the download can proceed.

    References:


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.