question

43342807 avatar image
0 Votes"
43342807 asked EchoDu-MSFT commented

Download complete folders and subfolders in SharePoint on-premise

I searched the board but couldn't find my case. We are using SharePoint on-premise and are not able to download complete folders but just files. If you select a folder , the download button is grayed and you receive a message that either I do not have the permission to use this feature or the feature is not supported at all. After speaking to our Sharepoint admin I was told that Microsoft has skipped the folder download feature for SharePoint on-premise. I honestly can't believe that as it is a very basic feature to download folders and not just files. Could someone please clarify this point?

office-sharepoint-server-administrationoffice-sharepoint-server-development
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @passuff-4972 ,

Would you tell me whether your issue has been resolved or have any update ?
I am looking forward to your reply.

Have a nice day!

0 Votes 0 ·

Hello @43342807 ,

Can you tell me whether your issue has been resolved or have any update?

I am looking forward to your reply.

0 Votes 0 ·
EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered EchoDu-MSFT edited

Hello @passuff-4972 ,

By design, Folders and Sub-folders can not support "Download a Copy" feature.

75960-3.png


However, you can download folders in the following two ways:

1) Use the "Open with Explorer" option available at the ribbon row. With the Explorer view open, you can copy+paste the folder in total to your local files, which does the same functionality as downloading would.

76082-1.png


2) Use SharePoint Designer to access the folder's path, where you can also download the folder with all of its contents.

76063-2.png

Thanks,
Echo Du
==================== Updated Answer =================

Hi @passuff-4972 ,

You cannot see the “All Files” in the SharePoint designer, because the “Enable Managing of the Web Site URL Structure" is disabled by your server administrator in the SharePoint Designer settings.

Please following steps:

1) Sign in SharePoint Central Administration as an admin
2) Go to General Application Settings tab, and click "Configure SharePoint Designer settings"

76698-settings1.png

3) Please enable "Enable Managing of the Web Site URL Structure" option under the corresponding web application.

76771-settings2.png

4) After enabling, you will see the “All Files” in the SharePoint designer.

Thanks,
Echo Du

------------------------------- Updated Answer --------------------------------

Hi @passuff-4972 ,

Please run the below PowerShell script as an admin to download all files(folders) in a Library:

 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 #Runtime-Variables
 $SiteURL = "siteurl"
 $LibraryName ="libraryname"
 $DownloadPath ="C:\temp"
     
 #Function to Download All Files from a SharePoint Folder
 Function Download-SPFolder($SPFolderURL, $DownloadPath)
 {
     Try {
         #Get the Source SharePoint Folder
         $SPFolder = $web.GetFolder($SPFolderURL)
         Write-host $SPFolder
         $DownloadPath = Join-Path $DownloadPath $SPFolder.Name
    
         #Ensure the destination local folder exists!
         If (!(Test-Path -path $DownloadPath))
         {   
             #If it doesn't exists, Create
             $LocalFolder = New-Item $DownloadPath -type directory
         }
      
         #Loop through each file in the folder and download it to Destination
         ForEach ($File in $SPFolder.Files)
         {
             #Download the file
             $Data = $File.OpenBinary()
             $FilePath= Join-Path $DownloadPath $File.Name
             [System.IO.File]::WriteAllBytes($FilePath, $data)
             Write-host -f Green "`tDownloaded the File:"$File.ServerRelativeURL        
         }
      
         #Process the Sub Folders & Recursively call the function
         ForEach ($SubFolder in $SPFolder.SubFolders)
         {
             If($SubFolder.Name -ne "Forms") #Leave "Forms" Folder
             {
                 #Call the function Recursively
                 Download-SPFolder $SubFolder $DownloadPath
             }
         }
     }
     Catch {
         Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message
     } 
 }
    
 #Main Function
 Function Download-SPDocumentLibrary($SiteURL, $LibraryName, $DownloadPath)
 {
     Try {
         #Get the  Web
         $Web = Get-SPWeb $SiteURL
     
         #Delete any existing files and folders in the download location
         If (Test-Path $DownloadPath) {Get-ChildItem -Path $DownloadPath -Recurse| ForEach-object {Remove-item -Recurse -path $_.FullName }}
     
         #Get the document Library to Download
         $Library = $Web.Lists[$LibraryName]
         Write-host -f magenta "Downloading Document Library:" $Library.Title
     
         #Call the function to download the document library
         Download-SPFolder -SPFolderURL $Library.RootFolder.Url -DownloadPath $DownloadPath
         Write-host -f Green "*** Download Completed  ***"
     }
     Catch {
         Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message
     } 
 }
    
 #Call the Function to export all document libraries from a site
 Download-SPDocumentLibrary $SiteURL $LibraryName $DownloadPath

77671-powershell.png

Thanks,
Echo Du

+++++++++++++++++ Updated Answer +++++++++++++++

Hi @passuff-4972 ,

I have changed my powershell script.

 Add-PSSnapin Microsoft.Sharepoint.Powershell
 $SiteURL = "http://sp/sites/echo"
 $LibraryName ="Documents"
 $DownloadPath ="C:\temp"
 Function Download-SPFolder($SPFolderURL, $DownloadPath)
 {
      Try {
          $SPFolder = $web.GetFolder($SPFolderURL)
          Write-host $SPFolder
          $DownloadPath = Join-Path $DownloadPath $SPFolder.Name 
          If (!(Test-Path -path $DownloadPath))
          {   
              $LocalFolder = New-Item $DownloadPath -type directory
          }
          #Loop through each file in the folder and download it to Destination
          ForEach ($File in $SPFolder.Files)
          {
              #Download the file
              $Data = $File.OpenBinary()
              $FilePath= Join-Path $DownloadPath $File.Name
              [System.IO.File]::WriteAllBytes($FilePath, $data)
              Write-host -f Green "`tDownloaded the File:"$File.ServerRelativeURL        
          }
          #Process the Sub Folders & Recursively call the function
          ForEach ($SubFolder in $SPFolder.SubFolders)
          {
              If($SubFolder.Name -ne "Forms")
              {
                  #Call the function Recursively
                  Download-SPFolder $SubFolder $DownloadPath
              }
          }
      }
      Catch {
          Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message
      } 
 }
 #Main Function
 Function Download-SPDocumentLibrary($SiteURL, $LibraryName, $DownloadPath)
 {
      Try {
          #Get the  Web
          $Web = Get-SPWeb $SiteURL
          #Delete any existing files and folders in the download location
          If (Test-Path $DownloadPath) {Get-ChildItem -Path $DownloadPath -Recurse| ForEach-object {Remove-item -Recurse -path $_.FullName }}
          #Get the document Library to Download
          $Library = $Web.Lists[$LibraryName]
          Write-host -f magenta "Downloading Document Library:" $Library.Title
          #Call the function to download the document library
          Download-SPFolder -SPFolderURL $Library.RootFolder.Url -DownloadPath $DownloadPath
          Write-host -f Green "*** Download Completed  ***"
      }
      Catch {
          Write-host -f Red "Error Downloading Document Library:" $_.Exception.Message
      } 
 }
 Download-SPDocumentLibrary $SiteURL $LibraryName $DownloadPath

Thanks,
Echo Du
======================
If an Answer is helpful, please click "Accept Answer" and upvote it.
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.





3.png (50.4 KiB)
1.png (83.0 KiB)
2.png (62.2 KiB)
settings1.png (51.8 KiB)
settings2.png (42.9 KiB)
powershell.png (46.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

43342807 avatar image
0 Votes"
43342807 answered EchoDu-MSFT commented

We already tried to integrate the Sharepoint content in to the Windows Explorer directly and also by OneDrive. Unfortunately the folder structure is huge and exceeds 400 signs. That's not an issue within Sharepoint but the content in those folders exceeding the limit is not visible in the Win Explorer.

I'm not able to find the "All Files" item on my Sharepoint:

sharepoint.png

We are also using Sharepoint online for different use cases but there we are able to download complete folders and sub folders out of the box. Why there is a difference is such a basic functionality between on premise and online Sharepoint?

Actually I don't need the functionality (download folders) itself but something letting me download/backup the whole Sharepoint data.


· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @passuff-4972 ,

I have updated answer under initial My Answer. Hope this can help you to solve issue.

Have a nice day!

Thanks,
Echo Du

0 Votes 0 ·

The item "Enable Managing of the Web Site URL Structure" is already checked but the "All Files" doesn't show up. Any idea what else needs to be activated?

0 Votes 0 ·

This solved the issue:

Kj5kv.png



Now I can find the data but I'm not able to download it to my windows explorer. Any hint how to do that?

0 Votes 0 ·
Show more comments
43342807 avatar image
0 Votes"
43342807 answered EchoDu-MSFT edited

There is no error message. If I choose a folder there is no way to to download it to the explorer. Zhere is just the copy option but this just works inside sharepoint designer so I'm not able to paste it in Windows Explorer.

· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @43342807 ,

I have updated answer under initial My Answer. Hope this can help you to solve issue.

Have a nice day!

Thanks,
Echo Du
===================
You can directly click “Comment” option under ”My Answered“ to put forward your opinions and thoughts about solution that I propose.


0 Votes 0 ·

Thx for the powershell script. Unfortunately it doesn't work for me:

Error Downloading Document Library: The name "Get-SPWeb" was not recognized as the name of a cmdlet, function, script file or executable. Check the spelling of the name, or if the path is correct (if included), and repeat the operation.

0 Votes 0 ·

Hi @passuff-4972 ,

Thanks for you reply.

I have changed my Powershell script under initial My Answer.

Thanks,
Echo Du





0 Votes 0 ·
Show more comments
sadomovalex avatar image
0 Votes"
sadomovalex answered 43342807 commented

you need to run mentioned Powershell script in Sharepoint Management Shell (not in regular Windows Powershell. And run it as administrator) from the Sharepoint server itself (i.e. not from another server remotely even if it is located in the same domain).

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thx. But then I wonder why I made all this steps before?
I just have client access. No access to the servers nor to the Sharepoint power shell.
I can upload the content but I can't download it if I'm not the overall Sharepoint admin? Getting frustrated...

0 Votes 0 ·