# SharePointサイトに接続
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive
# 特定のファイルのバージョン履歴を取得
$fileUrl = "/sites/yoursite/Shared Documents/yourfile.xlsx"
$versions = Get-PnPFileVersion -Url $fileUrl
# 各バージョンをダウンロード
$downloadPath = "C:\Downloads\FileVersions\"
New-Item -ItemType Directory -Path $downloadPath -Force
foreach ($version in $versions) {
$fileName = "yourfile_v$($version.VersionLabel).xlsx"
Get-PnPFile -Url $fileUrl -AsFile -Path $downloadPath -Filename $fileName -Version $version.VersionLabel
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme