downloading a file from SharePoint Online with PowerShell

前端 未结 5 2065
终归单人心
终归单人心 2020-12-10 09:43

I have a requirement to download files from a sharepoint online document library using powershell

I\'ve managed to get to the point where the download should happen

5条回答
  •  旧巷少年郎
    2020-12-10 10:10

    The direct and almost shortest answer to the question is simply:

    $url = 'https://the.server/path/to/the/file.txt'
    $outfile = "$env:userprofile\file.txt"
    Invoke-WebRequest -Uri $url -OutFile $outfile -Credential (Get-Credential)
    

    This works at least in Powershell 5.1...

提交回复
热议问题