How to Download a File from SharePoint Library using PowerShell?
Requirement: Download a File from SharePoint Document Library using PowerShell
How to Download a File from a Library in SharePoint?
Users can download copies of files from the SharePoint libraries to another location such as the local computer or any accessible network file share. To download a copy of a file from a document library, do the following:
Download a File from SharePoint using PowerShell
Here is how to download SharePoint File using PowerShell
To download all files from a SharePoint document library using PowerShell, use: Download All Files from SharePoint Document Library using PowerShell
How to Download a File from a Library in SharePoint?
Users can download copies of files from the SharePoint libraries to another location such as the local computer or any accessible network file share. To download a copy of a file from a document library, do the following:
- Go to your SharePoint document library and select the file to download.
- From the "Files" tab, Click on "Download a Copy" button from the ribbon.
- This opens the "Save as" pop-up. Click "Save as" and select a location where the document copy will be saved. Specify the name for the document and click on "Save".
Download a File from SharePoint using PowerShell
Here is how to download SharePoint File using PowerShell
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #Set Parameters $WebURL = "https://opera.crescent.com/sites/template/" $FileRelativedURL = "/Sites/template/Shared Documents/ASI-LOG.docx" $LocalFolderPath = "C:\Template" Try { #Ensure the destination local folder exists! if (!(Test-Path -path $LocalFolderPath)) { #If it doesn't exists, Create $LocalFolder = New-Item $LocalFolderPath -type directory } #Get the Fie $Web = Get-SPWeb $WebURL $File = $Web.GetFile($FileRelativedURL) #Download the file $Data = $File.OpenBinary() $FilePath = Join-Path $LocalFolderPath $File.Name [System.IO.File]::WriteAllBytes($FilePath, $Data) Write-host -f Green "File downloaded Successfully!" } Catch { Write-host -f Red "Error:" $_.Exception.Message }
To download all files from a SharePoint document library using PowerShell, use: Download All Files from SharePoint Document Library using PowerShell
No comments:
Please Login and comment to get your questions answered!