Hi @Enterprise Architect ,
The files in Teams channel are stored in the automatically created sharepoint site, and can be exported to the specified path using Pnp powershell.
If you have not used PnP powershell, please install PnP.PowerShell Module first :
Install-Module PnP.PowerShell -Scope CurrentUser
Pnp powershell code(You just need to replace $SiteURL and $DestinationFolder):
#Config Variables
$SiteURL = "https://yourdomain.sharepoint.com/sites/yoursite"
$FolderSiteRelativeUrl = "/Shared Documents/General"
$DestinationFolder ="C:\SP"
#Get Credentials to connect
$Cred = Get-Credential
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials $Cred
#Get All Files from the Folder
$FolderItems = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderSiteRelativeUrl -ItemType File -Recursive
Write-host "Total Number of Files in the Folder:" $FolderItems.Count
$Files = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderSiteRelativeUrl -ItemType File
foreach($File in $Files) {
Write-host -f magenta "Downloading file:" $File.Name
Get-PnPFile -Url $File.ServerRelativeUrl -Path $DestinationFolder -FileName $File.Name -AsFile
Write-host "*** Download Completed ***" -foregroundcolor Green
}
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
The running result is as below:
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.