Skip to content

Instantly share code, notes, and snippets.

View olegrumiancev's full-sized avatar

Oleg Rumiancev olegrumiancev

View GitHub Profile
@olegrumiancev
olegrumiancev / PowerShell-SharePointOnline-Upload-folder-to-doclib.ps1
Last active February 23, 2018 19:21
PowerShell - Upload a folder to SharePoint Online using PnP framework
function UploadDocuments() {
Param(
[ValidateScript({If(Test-Path $_){$true}else{Throw "Invalid path given: $_"}})]
$LocalFolderLocation,
[String]
$siteUrl,
[String]
$documentLibraryName
)
Process {
@olegrumiancev
olegrumiancev / PowerShell-public-directory-listing-download.ps1
Last active February 23, 2018 16:46
PowerShell public directory listing download
Import-Module BitsTransfer
function Download-File($src, $dest) {
$job = Start-BitsTransfer -Source $src -Destination $dest -Priority Normal -Asynchronous
while (($job.JobState.ToString() -eq "Transferring") -or ($job.JobState.ToString() -eq "Connecting")) {
$percent = [Math]::Round(($job.BytesTransferred/$job.BytesTotal),2)*100
Write-Progress -Activity "$($job.JobState)" -Status "$percent% Complete:" -PercentComplete $percent
Sleep 1
}