How do I download a document from SharePoint library programmatically?
Sarah Oconnor
Updated on March 01, 2026
Here is the complete code to download a file from Sharepoint:
- protected void DownloadFile(object sender, EventArgs e) {
- try {
- string filePath = (sender as LinkButton).
- //SharePoint Credentials.
- string username = “sharepoint_user”;
- string password = “sharepoint_password”;
- var securePassword = new SecureString();
How do I bulk download files from SharePoint?
To start, simply navigate to the your SharePoint site’s files folder. Then, select all the files you want to download by ticking the radio boxes at the left side of the file name. Then, click on the “Download” button at the command bar. Note that the files will be saved as a ZIP file.
How do I get documents from SharePoint library from REST API?
get documents from document library SharePoint rest api If you are using a SharePoint content editor webpart, then you can upload this snippet into site assets, copy the URL, create a SharePoint web part page, Insert Content Editor Webpart & then paste the URL and click on Save.
How do I download a folder from SharePoint?
Login to your SharePoint Online Site, Navigate to the Folder you want to download. Right-click on the Folder >> Choose “Download” from the context menu. You can also use the “Download” button from the toolbar. This brings you a Zip file with the Selected folder and its Sub-Folders and its files.
How do I copy files from SharePoint to my computer?
Copy
- Select the items that you want to copy, and then select Copy to. Or, for the item, select More.
- Under Choose a destination, select the location where you want a copy of the files or folders.
- In the text box, enter the name of the new folder.
- Select the checkmark, and then select Copy here.
How do I download a file from SharePoint using PowerShell?
Complete PowerShell Script
- #PowerShell script to Download files from SharePoint Online Document Library folder to network path.
- #Created By: Vinit Kumar.
- # Variable – Change the parameter as it need.
- $O365ServiceAccount = “[email protected]”
- $O365ServiceAccountPwd = “Test123$”
- # Change this SharePoint Site URL.
How do I create a download link in SharePoint?
Just navigate to the document library where your documents are located, select the file and click on the “Copy link” button in the ribbon >> Copy the URL and append “&download=1” to it. This URL directly links to document the download in SharePoint Online.
How do I download an entire folder from SharePoint?
How do I create a SharePoint access token?
Create an access token to use in any process activity or form control in an application.
- Click Build Apps .
- In the Application Explorer, on the My Applications pane, click [Application Name] > Shared Resources > Access Tokens.
- Click New .
- On the New App Token screen, select SharePoint .
- Click Next.
What is Requestdigest in REST API?
In classic pages, SharePoint includes a request digest token on the page in a hidden field named __REQUESTDIGEST. One of the most common approaches to work with the request digest is to obtain it from that field and add it to the request, for example: var digest = $(‘#__REQUESTDIGEST’).
How to download site files from SharePoint Server?
The SharePoint sever allows one to download site files by using different file export and import platforms. If you use Outlook to manage your emails and site information, you can also use it to download files from your site and edit them in Office 2007/2010 Outlook instead of using your browser.
How do I download files from a shared folder?
Note: If you’re downloading regularly from a Shared folder, you can add and sync shared folders to your own OneDrive. On your OneDrive, SharePoint Server 2019, or SharePoint in Microsoft 365 website, select the files or folders you want to download.
How do I upload multiple files to a SharePoint website?
1. Navigate to the SharePoint site that you want to upload or download multiple files. Open the internet explorer browser and type the address. Press ‘CTRL’ and “A” keys on your keyboard to select the URL address. Press “CTRL” and “C” keys to copy that URL.
How to copy and paste multiple files from a SharePoint site?
Windows explorer offers a great platform that allows SharePoint users to easily copy and paste multiple files from a SharePoint site. Instead of uploading individual files to a SharePoint site, you can use windows file explorer to copy them and upload multiple files to different site directories of your SharePoint site.