How to download EV archived files from Sharepoint 2013 using C# code

Krish 76 Reputation points
2021-11-26T15:58:35.337+00:00

Hi,

We have Enterprise vault software integrated with Sharepoint 2013 Server, where all the files will get archived after certain time of last modification.
When i tried to download the certain files from document libraries using below code,

How to download EV archived files from SharePoint 2013 using PowerShell or C# related similar code. I am getting only Short cut files converted on Sharepoint instead of Original file. When i manually download same file from browser using "Download a Copy" i am getting full file downloaded as per the original one which was uploaded originally to sharepoint. How to download a file programmatically in Copy paste manner from Sharepoint to local PC. Instead of using Binary array etc as mentioned below.

$FileInfo = [Microsoft.SharePoint.Client.File]::OpenBinaryDirect($Ctx,$SourceFile)
$WriteStream = [System.IO.File]::Open($TargetFile,[System.IO.FileMode]::Create)
$FileInfo.Stream.CopyTo($WriteStream)
$WriteStream.Close()

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,236 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,686 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,369 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,681 Reputation points Microsoft Vendor
    2021-11-29T07:11:55.313+00:00

    Hi @Krish ,
    Explorer view can do this. Go to the Document Library and choose Open with Explorer from the Ribbon
    153273-image.png
    Now in the Explorer view, navigate one level up, and you can download the complete site or site collection using explorer view by navigating up and down to the site, list or library objects.
    153170-image.png
    Please refer to the following code

    #Configuration Parameters  
    $DownloadPath= "c:\Downloads\Online"  
    #$WebDavUrl = "\\intranet.crescent.com\DavWWWRoot\sites\operations"  
    $webDavUrl = "\\crescent.sharepoint.com@SSL\DavWWWRoot\sites\operations" #SharePoint Online  
       
    #Create Local Folder it it doesn't exists  
    If(!(Test-Path $DownloadPath))  
    {  
          New-Item -ItemType Directory -Force -Path $DownloadPath | Out-Null  
    }  
       
    #Get All files from the Site and download to local folder  
    Get-ChildItem -Path $webDavUrl -Recurse | ForEach-Object {  
        #Frame the destination path  
        $DestinationPath = Join-Path -Path $DownloadPath -ChildPath (Split-Path $_.FullName -NoQualifier).Replace($webDavUrl,'');  
       
        #Copy File to local path  
        Copy-Item $_.FullName -Destination $DestinationPath -Force  
       
        Write-host -f Green File Copied to $DestinationPath  
    }  
    

    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.